2023-06-11 12:14:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FleetCart\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use FleetCart\Updater;
|
2023-12-03 14:07:47 +00:00
|
|
|
use Illuminate\Http\Request;
|
2023-06-11 12:14:03 +00:00
|
|
|
|
|
|
|
class RunUpdater
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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 $request, Closure $next): mixed
|
2023-06-11 12:14:03 +00:00
|
|
|
{
|
|
|
|
if (config('app.installed') && file_exists(storage_path('app/update'))) {
|
|
|
|
Updater::run();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|