I want to use middleware in Usercontroller
on only getDashboard()
and getUserlist()
method, but it didn't work for me.
also I add in controller constructor.
My Controller:
class Usercontroller extends Controller {
public function __construct() {
$this->middleware('auth',['only' => ['getDashboard']]);
//$this->middleware('auth');
}
##This method render home view.
public function index() {
// dd('yahoo');
return view('welcome');
}
##To add new user.
public function getAdduser() {
return view('register');
}
#To render dashboard view.
public function getDashboard() {
return view('dashboard');
}
When I directly type in url http://localhost/rabble/index.php/user/dashboard
.it still display display without authenticate user is login or not.