| Conditions | 7 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function handle(Request $request, Closure $next): mixed |
||
| 29 | { |
||
| 30 | // If discuss is disabled and the user is not admin. |
||
| 31 | if ((!Auth::user() && !settings('discuss_enabled')) || |
||
| 32 | (!settings('discuss_enabled') && !Auth::user()->hasPermissionTo('manage discuss conversation')) |
||
|
|
|||
| 33 | ) { |
||
| 34 | return redirect() |
||
| 35 | ->route('page.index') |
||
| 36 | ->error('The discuss system is temporarily disabled.'); |
||
| 37 | } |
||
| 38 | |||
| 39 | // If discuss is disabled and the user is admin. |
||
| 40 | if (!settings('discuss_enabled') && Auth::user()->hasPermissionTo('manage discuss conversation')) { |
||
| 41 | Toaster::error('The discuss system is temporarily disabled.'); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $next($request); |
||
| 45 | } |
||
| 47 |