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