Open webfuelcode opened 3 years ago
I am trying to show the different colors for liked and non-liked users on the view file.
I am using laravel 7, how to use $post->isFavorited() on laravel view file, with if-else statement...
$post->isFavorited()
if-else
You can do it like this
<span class="{{ $post->isFavorited() ? 'bg-yellow-500' : 'bg-gray-500' }}">⭐</span>
but it gives me eager loading issue https://github.com/ChristianKuri/laravel-favorite/issues/32
I am trying to show the different colors for liked and non-liked users on the view file.
I am using laravel 7, how to use
$post->isFavorited()
on laravel view file, withif-else
statement...