mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
a418dece80
* Better checking for empty values when updating. There's a lot of conditionals in here that we may want to look at cleaning up over time * Fix typo. No manfacturers here. * Fix model update/import. Also hardcode the status id of unset assets to the first existing one instead of an id that may not exist... Still not ideal, but better. * Let requests to .env through the middleware. We check to see if this is readable during setup as a warning, and as it stands it triggers an infinite loop trying to hit the file.
37 lines
690 B
PHP
37 lines
690 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)
|
|
{
|
|
|
|
if (Setting::setupCompleted()) {
|
|
|
|
if ($request->is('setup*')) {
|
|
return redirect(config('app.url'));
|
|
} else {
|
|
return $next($request);
|
|
}
|
|
|
|
} else {
|
|
if (!($request->is('setup*')) && !($request->is('.env'))) {
|
|
return redirect(config('app.url').'/setup')->with('Request', $request);
|
|
}
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|