mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 15:44:11 -08:00
d6ead5ae17
* Added health controller * Trying to move session middleware to web and api group to have health controller without session * Fix health route store the session Co-authored-by: Vincent Lainé <v.laine@dental-monitoring.com>
41 lines
826 B
PHP
41 lines
826 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Models\Setting;
|
|
use Closure;
|
|
|
|
class CheckForSetup
|
|
{
|
|
public function handle($request, Closure $next, $guard = null)
|
|
{
|
|
|
|
/**
|
|
* This is dumb
|
|
* @todo Check on removing this, not sure if it's still needed
|
|
*/
|
|
if ($request->is('_debugbar*')) {
|
|
return $next($request);
|
|
}
|
|
|
|
if (Setting::setupCompleted()) {
|
|
|
|
if ($request->is('setup*')) {
|
|
return redirect(url('/'));
|
|
} else {
|
|
return $next($request);
|
|
}
|
|
|
|
} else {
|
|
if (!($request->is('setup*')) && !($request->is('.env')) && !($request->is('health'))) {
|
|
return redirect(url('/').'/setup');
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|