本文整理汇总了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('/');
}
示例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('/');
}
示例3: logout
public function logout()
{
$user = \Sentinel::getUser();
\Sentinel::logout($user);
event(new Logout($user->getUserId()));
return redirect('/');
}
示例4: logout
public function logout()
{
\Session::flush();
\Sentinel::logout();
$data['title'] = 'Login';
return \Redirect::to('/');
}
示例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.');
}
示例6: do_logout
/**
* Logs the user out
*/
public function do_logout()
{
Sentinel::logout(null, true);
return Redirect::to('/user/login');
}
示例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');
}
示例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('/');
});
示例9: getLogout
public function getLogout()
{
\Sentinel::logout(null, true);
return redirect()->route('admin.login');
}
示例10: logout
public function logout()
{
$this->app->flash('info', 'Come back sometime soon');
Sentinel::logout(null, true);
$this->redirect('login');
}