当前位置: 首页>>代码示例>>PHP>>正文


PHP Sentinel::logout方法代码示例

本文整理汇总了PHP中Sentinel::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentinel::logout方法的具体用法?PHP Sentinel::logout怎么用?PHP Sentinel::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sentinel的用法示例。


在下文中一共展示了Sentinel::logout方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logout

 /**
  * Logs the user out.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function logout()
 {
     Sentinel::logout();
     return Redirect::to('/');
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:10,代码来源:AuthController.php

示例2: logout

 /**
  * Log a user out
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function logout()
 {
     $user = \Sentinel::getUser();
     \Sentinel::getUserRepository()->recordLogout($user);
     \Sentinel::logout();
     return redirect('/');
 }
开发者ID:brucewu16899,项目名称:Core,代码行数:11,代码来源:AuthController.php

示例3: logout

 public function logout()
 {
     $user = \Sentinel::getUser();
     \Sentinel::logout($user);
     event(new Logout($user->getUserId()));
     return redirect('/');
 }
开发者ID:tankerkiller125,项目名称:newscms,代码行数:7,代码来源:AuthController.php

示例4: logout

 public function logout()
 {
     \Session::flush();
     \Sentinel::logout();
     $data['title'] = 'Login';
     return \Redirect::to('/');
 }
开发者ID:umahatokula,项目名称:academia,代码行数:7,代码来源:loginController.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Sentinel::check()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(route('admin.login'));
         }
     }
     if ($request->route()->getName() == "admin.logout") {
         return $next($request);
     }
     if (count($request->route()->parameters()) == 0) {
         //Dashboard or some custom page
         if ($request->route()->getName() == "admin.dashboard" || starts_with($request->route()->getName(), "admin.upload.") || starts_with($request->route()->getName(), "elfinder.")) {
             if (\Sentinel::hasAnyAccess(['superadmin', 'controlpanel'])) {
                 return $next($request);
             } else {
                 \Sentinel::logout(null, true);
                 return redirect()->guest(route('admin.login'));
             }
         }
     } else {
         //use dynamic permissions
         $route_alias = explode(".", $request->route()->getName());
         if (!isset($route_alias[2])) {
             $route_alias[2] = 'view';
         } elseif ($route_alias[2] == 'update') {
             $route_alias[2] = 'edit';
         } elseif ($route_alias[2] == 'store') {
             $route_alias[2] = 'create';
         } else {
             $route_alias[2];
         }
         if (is_null($request->route()->parameters()['adminModel']->permission())) {
             if ($route_alias[2] == "view") {
                 $model_permissions = ["admin." . $request->route()->parameters()['adminModel']->alias() . ".view"];
             } else {
                 $model_permissions = ["admin." . $request->route()->parameters()['adminModel']->alias() . "." . $route_alias[2]];
             }
         } else {
             $model_permissions = explode(",", $request->route()->parameters()['adminModel']->permission());
             if ($route_alias[2] == "view") {
                 $model_permissions[] = "admin." . $request->route()->parameters()['adminModel']->alias() . ".view";
             } else {
                 $model_permissions[] = "admin." . $request->route()->parameters()['adminModel']->alias() . "." . $route_alias[2];
             }
         }
         $model_permissions[] = "superadmin";
         if (\Sentinel::hasAnyAccess($model_permissions)) {
             return $next($request);
         }
     }
     return redirect()->route('admin.dashboard')->withErrors('Permission denied.');
 }
开发者ID:johnshepherd,项目名称:soa-sentinel,代码行数:62,代码来源:AdminAuthenticate.php

示例6: do_logout

 /**
  * Logs the user out
  */
 public function do_logout()
 {
     Sentinel::logout(null, true);
     return Redirect::to('/user/login');
 }
开发者ID:sourcedonates,项目名称:SDv2-Code,代码行数:8,代码来源:UserController.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $custom_routes = config('admin.custom_routes');
     $system_route = false;
     $route_name = $request->route()->getName();
     $route_parameters = $request->route()->parameters();
     if (!\Sentinel::check()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(route('admin.login'));
         }
     }
     if ($route_name == "admin.logout") {
         return $next($request);
     }
     if (starts_with($route_name, "elfinder.") || starts_with($route_name, "admin.upload.") || starts_with($route_name, 'admin.settings')) {
         $system_route = true;
     }
     if (array_key_exists($route_name, $custom_routes) || $system_route) {
         $config_permissions = !$system_route ? $custom_routes[$route_name]['permission'] : null;
         $check_permissions = !empty($config_permissions) ? $config_permissions : config('admin.defaultPermission');
         if (\Sentinel::hasAnyAccess($check_permissions)) {
             return $next($request);
         } elseif (array_key_exists('logout', $custom_routes[$route_name]) && $custom_routes[$route_name]['logout']) {
             \Sentinel::logout(null, true);
             return redirect()->guest(route('admin.login'));
         }
     } else {
         //use dynamic permissions
         $route_alias = explode(".", $route_name);
         if (!isset($route_alias[2])) {
             $route_alias[2] = 'view';
         } elseif ($route_alias[2] == 'update') {
             $route_alias[2] = 'edit';
         } elseif ($route_alias[2] == 'store') {
             $route_alias[2] = 'create';
         } else {
             $route_alias[2];
         }
         if (is_null($route_parameters['adminModel']->permission())) {
             if ($route_alias[2] == "view") {
                 $model_permissions = ["admin." . $route_parameters['adminModel']->alias() . ".view"];
             } else {
                 $model_permissions = ["admin." . $route_parameters['adminModel']->alias() . "." . $route_alias[2]];
             }
         } else {
             $model_permissions = explode(",", $route_parameters['adminModel']->permission());
             if ($route_alias[2] == "view") {
                 $model_permissions[] = "admin." . $route_parameters['adminModel']->alias() . ".view";
             } else {
                 $model_permissions[] = "admin." . $route_parameters['adminModel']->alias() . "." . $route_alias[2];
             }
         }
         $model_permissions[] = "superadmin";
         if (\Sentinel::hasAnyAccess($model_permissions)) {
             return $next($request);
         }
     }
     flash()->error(trans('admin::lang.permission.denied'));
     return redirect()->route('admin.dashboard');
 }
开发者ID:pseudoagentur,项目名称:soa-sentinel,代码行数:69,代码来源:AdminAuthenticate.php

示例8: function

    Route::get('destroy', 'CartController@destroy');
    Route::get('count', 'CartController@countAjax');
});
Route::group(['prefix' => 'wishlist'], function () {
    Route::get('/', 'WishlistController@index');
    Route::post('/', 'WishlistController@update');
    Route::get('{id}/add', 'WishlistController@add');
    Route::get('{id}/move', 'WishlistController@move');
    Route::get('{id}/addAjax', 'WishlistController@addAjax');
    Route::get('{id}/remove', 'WishlistController@delete');
    Route::get('{id}/removeAjax', 'WishlistController@deleteAjax');
    Route::get('destroy', 'WishlistController@destroy');
    Route::get('count', 'WishlistController@countAjax');
});
Route::group(['prefix' => 'coupon'], function () {
    Route::post('/', ['as' => 'applyCoupon', 'uses' => 'CartController@applyCoupon']);
    Route::get('remove/{name}', 'CartController@removeCoupon');
});
Route::get('login', function () {
    return View::make('cart.login');
});
Route::post('login', function () {
    if (Sentinel::authenticate(Input::all())) {
        return Redirect::to('/');
    }
    return Redirect::to('login');
});
Route::get('logout', function () {
    Sentinel::logout();
    return Redirect::to('/');
});
开发者ID:Denniskevin,项目名称:demo-cart,代码行数:31,代码来源:routes.php

示例9: getLogout

 public function getLogout()
 {
     \Sentinel::logout(null, true);
     return redirect()->route('admin.login');
 }
开发者ID:johnshepherd,项目名称:soa-sentinel,代码行数:5,代码来源:AuthController.php

示例10: logout

 public function logout()
 {
     $this->app->flash('info', 'Come back sometime soon');
     Sentinel::logout(null, true);
     $this->redirect('login');
 }
开发者ID:EpykOS,项目名称:epykosLittleHelper,代码行数:6,代码来源:login.controller.php


注:本文中的Sentinel::logout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。