I have configured my route the following way;
Route::model('terms', 'Term');
Route::resource('terms', 'TermController');
Route::bind('terms', function($value, $route) {
return App\Term::whereId($value)->first();
});
This results in having automatically the term model available in default functions, edit, show, etc. See below a code snippet from my controller.
public function update(Term $term) {
//update term
}
However I want to extent my controller with a couple of new functions. So when I navigate to terms/{term}/review the $term is automatically injected into my controller. Is there any way to do this? Some like below? Any help is much appreciated!
Route::get('terms/{term}/review', function (App\Term $term) {
use TermController@review;
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire