Ejemplo n.º 1
0
    }
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
Route::filter('roleAdmin', function () {
    $res = RoleUser::whereRoleId(1)->whereUserId(Auth::user()->id)->count();
    if ($res == 0) {
        return Redirect::to('profile');
    }
});
Route::filter('testRole', function ($route, $request, $value = '') {
    if (!Auth::user()->isCompetent($value)) {
        return Redirect::to('profile');
    }
});
Route::filter('lang', function () {
    App::setLocale('ru');
});