I have a model like this:
class Event extends Eloquent
{
protected $softDelete = true;
public function scopeSearchEvents($search_criteria)
{
return Event::whereIn('title',$search_criteria)
->orWhereIn('description',$search_criteria)
->whereApproved('1')
->orderBy('event_date','desc')
->get();
}
}
And im calling it from the controller like this:
$data = Event::search($search_criteria);
But it gives this error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to undefined method Illuminate\Events\Dispatcher::search()
What is the best way of calling a custom model method from your controller?