mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-19 20:14:09 -08:00
42 lines
785 B
PHP
42 lines
785 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Config;
|
|
use Route;
|
|
use Schema;
|
|
use App\Models\User;
|
|
use App\Models\Setting;
|
|
|
|
class CheckForSetup
|
|
{
|
|
public function handle($request, Closure $next, $guard = null)
|
|
{
|
|
|
|
// This is dumb
|
|
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'))) {
|
|
return redirect(url('/').'/setup')->with('Request', $request);
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|