Conditions | 4 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function handle(Router $router) |
||
17 | { |
||
18 | $routes = $router->getRoutes(); |
||
19 | |||
20 | $routesWithoutGate = collect($routes) |
||
21 | ->filter(function ($route) { |
||
22 | return $this->hasMiddleware($route) && ! $this->hasGate($route); |
||
23 | }) |
||
24 | ->map(function ($route) { |
||
25 | return [$route->getName() ?: $route->getPrefix()]; |
||
26 | }); |
||
27 | |||
28 | if ($routesWithoutGate->isEmpty()) { |
||
29 | $this->info('Great job, no routes without gate. :)'); |
||
30 | |||
31 | return 0; |
||
32 | } else { |
||
33 | $this->error('You got routes without gate, see list below:'); |
||
34 | $this->table(['Route'], $routesWithoutGate->all()); |
||
35 | |||
36 | return 1; |
||
37 | } |
||
38 | } |
||
39 | |||
50 |