Im trying to query my NewsItem table for articles written in a given month / year.
I'm passing the url a GET variable
'/news?filter=true&month=January 2017'
In my controller I'm catching the variable and trying to run the query on my modal
if(Input::get('month')){
$articles = NewsItem::where(DB::raw('created_at'),function($d){
Carbon::parse($d->created_at)->format('F Y') = Input::get('month');
})->get();
};
But I get the following error
FatalErrorException in NewsController.php line 28: Can't use method return value in write context
I'd like to know more about the function element within eloquent, are there any articles that will guide me in the right direction?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iLrdbe
via IFTTT
Aucun commentaire:
Enregistrer un commentaire