本文整理汇总了PHP中Illuminate\Contracts\Auth\Guard::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Guard::check方法的具体用法?PHP Guard::check怎么用?PHP Guard::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Auth\Guard
的用法示例。
在下文中一共展示了Guard::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect(env('REDIRECT_AUTHENTICATED', '/dashboard'));
}
return $next($request);
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return new RedirectResponse(route('after_login'));
}
return $next($request);
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
//return redirect('/user/dashboard');
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() && !$request->user()->hasGroup('admin')) {
return redirect('/');
}
return $next($request);
}
示例5: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return \Redirect::back();
}
return $next($request);
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->auth->check()) {
return Redirect::route('frontpage');
}
return $next($request);
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param int|string $role
* @return mixed
* @throws \FWM\Roles\Exceptions\RoleDeniedException
*/
public function handle($request, Closure $next, $role)
{
if ($this->auth->check() && $this->auth->user()->is($role)) {
return $next($request);
}
throw new RoleDeniedException($role);
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param int|string $role
* @return view
*/
public function handle($request, Closure $next, $role)
{
if ($this->auth->check() && $this->auth->user()->is($role)) {
return $next($request);
}
return $this->auth->check() ? view('lcp::auth.errors.role')->withError($role) : view('lcp::auth.login');
}
示例9: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect(\Config::get('portal.auth_login_home'));
}
return $next($request);
}
示例10: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return Helpers::redirectDashboard();
}
return $next($request);
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->auth->check()) {
return redirect()->guest('auth/login');
}
return $next($request);
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect()->route('user.info', ['id' => $this->auth->id()]);
}
return $next($request);
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->auth->check() or !$this->auth->user()->canAccessAdminPanel()) {
return redirect('/auth/login?ref=admin');
}
return $next($request);
}
示例14: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() and $this->auth->user()->is('admin')) {
return new RedirectResponse(route('home'));
}
return $next($request);
}
示例15: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param int|string $permission
* @return mixed
* @throws \Bican\Roles\Exceptions\PermissionDeniedException
*/
public function handle($request, Closure $next, $permission)
{
if ($this->auth->check() && $this->auth->user()->may($permission)) {
return $next($request);
}
throw new PermissionDeniedException($permission);
}