Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

redirect to login using auth guard laravel

protected $guards = [];

public function handle($request, Closure $next, ...$guards)
{
    $this->guards = $guards;

    return parent::handle($request, $next, ...$guards);
}
protected function redirectTo($request)
{
    if (in_array("admin", $this->guards)) {
        return "admin/login";
    }

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #redirect #login #auth #guard #laravel
ADD COMMENT
Topic
Name
3+3 =