FleetCart/app/Http/Middleware/CheckForMaintenanceMode.php

42 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace FleetCart\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as BaseCheckForMaintenanceMode;
class CheckForMaintenanceMode extends BaseCheckForMaintenanceMode
{
/**
* The URIs that should be accessible while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
'*/admin*',
];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Illuminate\Foundation\Http\Exceptions\MaintenanceModeException
*/
public function handle($request, Closure $next)
{
if (
config('app.installed')
&& $this->app->isDownForMaintenance()
&& optional(auth()->user())->hasRoleName('Admin')
) {
return $next($request);
}
return parent::handle($request, $next);
}
}