Example #1
0
Route::filter('auth', function () {
    if (!Sentry::check()) {
        return Redirect::guest('/')->with('errorMessage', 'Silakan Login Terlebih Dahulu.');
    }
});
Route::filter('udah', function () {
    if (Sentry::check()) {
        return Redirect::route('dashboard')->with('errorMessage', 'Anda Sudah Login');
    }
});
Route::filter('auth', function () {
    if (Auth::user()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::user('/');
        }
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|