| Conditions | 3 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function register() |
||
| 23 | { |
||
| 24 | $this->mergeConfigFrom(__DIR__.'/../config/demo-mode.php', 'demo-mode'); |
||
| 25 | |||
| 26 | $router = $this->app['router']; |
||
| 27 | |||
| 28 | $router->macro('demoAccess', function ($url) use ($router) { |
||
| 29 | if (!config('demo-mode.enabled') || config('demo-mode.strict_mode')) { |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $router->get($url, '\Spatie\DemoMode\DemoModeController@grantAccess'); |
||
| 34 | }); |
||
| 35 | |||
| 36 | $router->fallback('\Spatie\DemoMode\DemoModeController@catchFallback'); |
||
| 37 | |||
| 38 | $this->app->singleton(DemoGuard::class, config('demo-mode.guard')); |
||
| 39 | } |
||
| 41 |