dimanche 2 juin 2019

Function of $this->middleware('atuh:guard') and $this->middleware('guest:guard')

Laravel documentation says that we can pass parameter to a middleware specifying with :. here

So, If I am passing a guard as a parameter to guest or auth middleware like :

$this->middleware('guest:admin')

OR

$this->middleware('auth:admin')

What does that mean?

As here in AdminController.php

    class AdminController extends Controller
{

    use AuthenticatesUsers;


    protected $redirectTo = '/admin/dashboard';

    public function __construct()
    {
        $this->middleware('auth:admin')->except(['show_login','login']);
        $this->middleware('guest:admin')->only(['show_login','login']);
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire