laravel-langman-gui icon indicating copy to clipboard operation
laravel-langman-gui copied to clipboard

Middleware issue

Open robertnicjoo opened this issue 6 years ago • 1 comments

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?

robertnicjoo avatar Mar 12 '18 16:03 robertnicjoo

Try:

'middleware' => ['web', 'role:Admin'],

The web middleware is responsible for the user session etc, and should be accessed before anything else.

JapSeyz avatar Apr 03 '18 21:04 JapSeyz