0
모델을 필터에 실제로 전달하려면 어떻게합니까?모델을 필터에 전달
나는 책을 편집하고 저장할 수있는 충분한 권한을 가진 사용자를 허용하는 양식이 있습니다.
Route::model('book', 'Book');
Route::get('/edit/{book}', array('before' => 'my_filter', 'uses' => '[email protected]'));
Route::filter('my_filter', function() {
// check if authenticated has enough privilege to edit a book
// Would like to do something like $book->AuthorID == Auth()::user()->AuthorID
});
의견이 있으십니까? 감사!
해결책을 찾았습니다. 'my_filter'에서'$ book = $ route-> getParameter ('book')'을 추가하면'Book' 모델을 검색 할 수 있습니다. – sc1013