PHP Classes
elePHPant
Icontem

File: app/Http/Middleware/RedirectIfAuthenticated.php

Recommend this page to a friend!
  Classes of Renato De Oliveira Lucena  >  PHP Pokemon Script  >  app/Http/Middleware/RedirectIfAuthenticated.php  >  Download  
File: app/Http/Middleware/RedirectIfAuthenticated.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Pokemon Script
Provides an API to manage a database of Pokemons
Author: By
Last change:
Date: 2 years ago
Size: 523 bytes
 

 

Contents

Class file image Download
<?php

namespace App\Http\Middleware;

use
Closure;
use
Illuminate\Support\Facades\Auth;

class
RedirectIfAuthenticated
{
   
/**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @param string|null $guard
     * @return mixed
     */
   
public function handle($request, Closure $next, $guard = null)
    {
        if (
Auth::guard($guard)->check()) {
            return
redirect('/home');
        }

        return
$next($request);
    }
}