Controller filter does not work in the default controller |
Hi, I created a controller filter that checks if the user is logged in, but it doesn't work in the default controller (Home.php in this case).
It also happens that it doesn't work in any index method unless you put it also without the asterisk('user/*', 'user/'). Thank you and I appreciate a reply. This is how I got it: // List filter aliases and any before/after uri patterns // that they should run on, like: // 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']], public $filters = [ 'isLoggedIn' => ['before' => [ 'user/*', 'user/','home/*']],
Hello, I had the same problem.
`user/*` means the filter to be applied on any other URIs after user/. To include `user`, do the following: `public $filters = [ 'isLoggedIn' => ['before' => [ 'user*', 'home*']], ]` Note, there is no forward-slash before the *. |
Welcome Guest, Not a member yet? Register Sign In |