| 1 | <?php |
||
| 12 | class AuthMiddleware implements MiddlewareInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Messages |
||
| 16 | */ |
||
| 17 | protected $flash; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $role; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var Router |
||
| 26 | */ |
||
| 27 | protected $router; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var Sentinel |
||
| 31 | */ |
||
| 32 | protected $sentinel; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Constructor. |
||
| 36 | * |
||
| 37 | * @param Router $router |
||
| 38 | * @param Messages $flash |
||
| 39 | * @param Sentinel $sentinel |
||
| 40 | * @param string $role |
||
| 41 | */ |
||
| 42 | public function __construct(Router $router, Messages $flash, Sentinel $sentinel, $role = null) |
||
| 43 | { |
||
| 44 | $this->router = $router; |
||
| 45 | $this->flash = $flash; |
||
| 46 | $this->sentinel = $sentinel; |
||
| 47 | $this->role = $role; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | public function __invoke(Request $request, Response $response, callable $next) |
||
| 65 | } |
||
| 66 |