Bir filtre içindeki rota parametrelerine erişmek mümkün mü?Bir filtreye geçme argümanları - Laravel 4
örn.
Route::group(array('prefix' => 'agency'), function()
{
# Agency Dashboard
Route::get('{agencyId}', array('as' => 'agency', 'uses' => 'Controllers\Agency\[email protected]'));
});
benim filtre içinde bu $ agencyId parametreyi erişmek istediğiniz: Ben $ agencyId parametresini erişmek istediğiniz
Route::filter('agency-auth', function()
{
// Check if the user is logged in
if (! Sentry::check())
{
// Store the current uri in the session
Session::put('loginRedirect', Request::url());
// Redirect to the login page
return Redirect::route('signin');
}
// this clearly does not work..? how do i do this?
$agencyId = Input::get('agencyId');
$agency = Sentry::getGroupProvider()->findById($agencyId);
// Check if the user has access to the admin page
if (! Sentry::getUser()->inGroup($agency))
{
// Show the insufficient permissions page
return App::abort(403);
}
});
i gibi benim denetleyicisi bu filtreyi diyoruz Sadece referans için:
bu '$ kullanabilirsiniz:
Başka bir seçenek de bir rotanın dışında olduğunda kullanışlıdır
Route
cephesi aracılığıyla parametreyi almak için agencyId = Request :: segment (2) 'filtrede' agencyId 'değerini almak için –