isYesterday is a method on the instance, you need to change your if block to be
@if($post->created_at->isYesterday())
Great, many thanks. It works. How to Output if a method on the instance?
Example. How to Output the "SATURDAY?
Like this?
{{ $post->created_at->isWeekday(dayOfWeek) }}
/**
* Determines if the instance is a weekday
*
* @return boolean
*/
public function isWeekday()
{
return ($this->dayOfWeek != self::SUNDAY && $this->dayOfWeek != self::SATURDAY);
}
/**
* Determines if the instance is a weekend day
*
* @return boolean
*/
public function isWeekend()
{
return !$this->isWeekDay();
}
You can check all the available methods here:
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community