vendredi 29 novembre 2019

Laravel Middleware page authority

the idea is i want to use middleware for filtering their roles to my ektp routes. so only the users that had been logged in can access the ektp page, if not it will be redirect it to home and give alert "you need to login".

web.php

route::get('/ektp','PagesController@ektp');

i tried to add ->middleware(users) like my login and register route so it will only displaying on a guest. but some how i got an error Auth guard [users] is not defined. if i do it like that. and when i tried to add protected $guard ='user'; inside ektp model it still show me the same error.

//register
route::get('/register','AuthController@getRegister')->middleware('guest');
route::any('/register','AuthController@postRegister')->middleware('guest');

//login
route::get('/login','AuthController@getLogin')->middleware('guest');
route::any('/login','AuthController@postLogin')->middleware('guest');


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire