laravel-langman-gui
laravel-langman-gui copied to clipboard
Middleware issue
Hi,
I have problem with making middleware for this package
here is what I tried so far:
1- code below in config/langmanGUI.php
'route_group_config' => [
'middleware' => ['role:Admin'],
'namespace' => 'Themsaid\LangmanGUI'
]
- result: show page in both logged/not logged users
2- code above in vendor/config/langmanGUI.php
- result:
Spatie \ Permission \ Exceptions \ UnauthorizedException
User is not logged in.
3- adding code below to LangmanController.php
public function __construct()
{
$this->middleware(['role:Admin|Editor']);
}
- result:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to undefined method Themsaid\LangmanGUI\LangmanController::middleware()
any idea how to fix it?
Try:
'middleware' => ['web', 'role:Admin'],
The web middleware is responsible for the user session etc, and should be accessed before anything else.