Laravel has a documentation regarding route model binding which could be found here. But there is no example with regards to this kind of scenario:
Route::get('search/', 'ArticleController@search');
How to I implicitly bind a model into the route? I know I could do something like this directly on the controller's method.
public function search(Model $model) {
// some code here
}
But I'm just curious on how to do it on the routes instead.
I am after this approach
Route::get('search/{article}', function(ArticlesModel $articlesModel) {
// this should be calling 'ArticleController@search'
});
Thanks!