laravel auth home file code example

Example 1: laravel 7 auth

composer require laravel/ui

php artisan ui vue --auth

Example 2: login and registration in laravel7 using middleware

<?php

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class user
{
   
    /**
     * 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::user() =='')
        //  {
               
              
        //     return redirect(RouteServiceProvider::HOME);
        // }

        return $next($request);
    }
}

Tags:

Php Example