I am trying to filter a collection of objects by comparing date its expiry date with today's date but I cant quite get it to work. Can anyone take a look at the code. I'm sure i'm missing something here. I have searched all over and found alot of examples but none are working.
This complies just fine but with a list of 9 objects 3 of which have an expiry date which is set to 2012 it doesn't return any results from the collection.
Controller
public function classifieds()
{
$myclassifieds = Auth::user()->classifieds;
return view('account.classifieds')->with(['allclassifieds'=>$myclassifieds]);
}
View
@if(count($allclassifieds->where('expired_on','<', Carbon\Carbon::now() ) ) > 0)
//Something here
@endif
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire