2023-06-11 12:14:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FleetCart\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
2023-12-03 14:07:47 +00:00
|
|
|
use Illuminate\Http\Request;
|
2023-06-11 12:14:03 +00:00
|
|
|
|
|
|
|
class RedirectToInstallerIfNotInstalled
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2023-12-03 14:07:47 +00:00
|
|
|
* @param Request $request
|
|
|
|
* @param Closure $next
|
|
|
|
*
|
2023-06-11 12:14:03 +00:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2023-12-03 14:07:47 +00:00
|
|
|
public function handle($request, Closure $next): mixed
|
2023-06-11 12:14:03 +00:00
|
|
|
{
|
2023-12-03 14:07:47 +00:00
|
|
|
if (!config('app.installed') && !$request->is('install')) {
|
|
|
|
return redirect()->route('install.show');
|
2023-06-11 12:14:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|