mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
31 lines
534 B
PHP
31 lines
534 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
use Config;
|
||
|
use Route;
|
||
|
|
||
|
class CheckForSetup
|
||
|
{
|
||
|
public function handle($request, Closure $next, $guard = null)
|
||
|
{
|
||
|
|
||
|
try {
|
||
|
$usercount = \App\Models\User::withTrashed()->count();
|
||
|
if (($usercount > 0) && (Route::is('setup*'))) {
|
||
|
return redirect(config('app.url'));
|
||
|
} else {
|
||
|
return $next($request);
|
||
|
}
|
||
|
} catch (\Exception $e) {
|
||
|
return $next($request);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|