I want to remove ‘new’ label on the post title for those posted more than 30days ago I tried this in view but not working
@foreach ($post as $p)
@if(DB::table('post')->whereRaw('DATEDIFF(created_at, now()) > 30')->get())
emove label goes here ...
@endif
@endforeach
note my label is a gif image so it found in the asset folder
2
Answers
Better solution is to use accessor.
Ex. your model is Post::class, then add method:
then in blade template using like this
You can achieve this in pure PHP or by using accessors. For example:
@endphp