mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 08:04:09 -08:00
e3e0d57f56
* Add IDE Helper files * Cleanup imports - Alphabetises imports - Removes unused imports * Add Platform requirements * Move filling asset into block where asset exists * Remove duplicate array keys
41 lines
797 B
PHP
41 lines
797 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'))) {
|
|
return redirect(url('/').'/setup');
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|