source: app/Http/Middleware/RedirectIfAuthenticated.php@ 28bab7b

Last change on this file since 28bab7b was 2fc88ec, checked in by beratkjufliju <kufliju@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 734 bytes
Line 
1<?php
2
3namespace App\Http\Middleware;
4
5use App\Providers\RouteServiceProvider;
6use Closure;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\Auth;
9
10class RedirectIfAuthenticated
11{
12 /**
13 * Handle an incoming request.
14 *
15 * @param \Illuminate\Http\Request $request
16 * @param \Closure $next
17 * @param string|null ...$guards
18 * @return mixed
19 */
20 public function handle(Request $request, Closure $next, ...$guards)
21 {
22 $guards = empty($guards) ? [null] : $guards;
23
24 foreach ($guards as $guard) {
25 if (Auth::guard($guard)->check()) {
26 return redirect(RouteServiceProvider::HOME);
27 }
28 }
29
30 return $next($request);
31 }
32}
Note: See TracBrowser for help on using the repository browser.