mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
161999fbca
Signed-off-by: snipe <snipe@snipe.net>
36 lines
842 B
PHP
36 lines
842 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(config('app.url'));
|
|
} else {
|
|
return $next($request);
|
|
}
|
|
} else {
|
|
if (! ($request->is('setup*')) && ! ($request->is('.env')) && ! ($request->is('health'))) {
|
|
return redirect(config('app.url').'/setup');
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|
|
}
|