Total Complexity | 6 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class DefaultDemoGuard implements DemoGuard |
||
8 | { |
||
9 | public function hasDemoAccess(Request $request): bool |
||
10 | { |
||
11 | if ($this->isIpAuthorized($request) || auth()->check()) { |
||
12 | return true; |
||
13 | } |
||
14 | |||
15 | return $this->demoRouteEnabled() && session()->has('demo_access_route_visited'); |
||
16 | } |
||
17 | |||
18 | protected function demoRouteEnabled(): bool |
||
19 | { |
||
20 | return !config('demo-mode.strict_mode'); |
||
21 | } |
||
22 | |||
23 | protected function isIpAuthorized(Request $request): bool |
||
26 | } |
||
27 | } |
||
28 |