2019-07-18 22:51:05 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
2019-11-19 23:54:42 +08:00
|
|
|
use App\Services\Installer\InstallerService;
|
2019-07-18 22:51:05 +08:00
|
|
|
use Closure;
|
|
|
|
|
2019-11-19 23:54:42 +08:00
|
|
|
/**
|
|
|
|
* Determine if an update is pending by checking in with the Installer service
|
|
|
|
*/
|
2019-07-18 22:51:05 +08:00
|
|
|
class UpdatePending
|
|
|
|
{
|
2019-11-19 23:54:42 +08:00
|
|
|
private $installerSvc;
|
2019-07-18 22:51:05 +08:00
|
|
|
|
2019-11-19 23:54:42 +08:00
|
|
|
public function __construct(InstallerService $installerSvc)
|
2019-07-18 22:51:05 +08:00
|
|
|
{
|
2019-11-19 23:54:42 +08:00
|
|
|
$this->installerSvc = $installerSvc;
|
2019-07-18 22:51:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
2019-11-19 23:54:42 +08:00
|
|
|
if ($this->installerSvc->isUpgradePending()) {
|
2019-07-18 22:51:05 +08:00
|
|
|
return redirect('/update/step1');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|