Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     if (!BEUsersHelper::isAdmin()) {
         Redirect::to('/');
     }
 }
Beispiel #2
0
*/
Route::filter('guest', function () {
    if (Auth::check()) {
        return Redirect::to('/');
    }
});
/*
|--------------------------------------------------------------------------
| 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('checkAdmin', function () {
    if (!BEUsersHelper::isAdmin()) {
        $messages = array();
        $status = false;
        $messages[] = "Bạn không có quyền vào trang này";
        Session::flash('status', $status);
        Session::flash('messages', $messages);
        return Redirect::to('/');
    }
});