Laravel guarded

 

 

<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class SetDefaultGuardMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param Request $request
     * @param Closure $next
     * @param $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard)
    {
        config(['auth.defaults.guard' => $guard]);
        return $next($request);
    }
}

 

posted @ 2021-11-17 15:58  无风何其浪  阅读(52)  评论(0编辑  收藏  举报