mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:14:03 +00:00
Update tenant maintenance mode te be in line with Laravel
This commit is contained in:
parent
2bece24b07
commit
22a2f90ec8
2 changed files with 10 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
||||
use Stancl\Tenancy\Exceptions\TenancyNotInitializedException;
|
||||
use Symfony\Component\HttpFoundation\IpUtils;
|
||||
|
|
@ -29,7 +29,12 @@ class CheckTenantForMaintenanceMode extends CheckForMaintenanceMode
|
|||
return $next($request);
|
||||
}
|
||||
|
||||
throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']);
|
||||
throw new HttpException(
|
||||
503,
|
||||
'Service Unavailable',
|
||||
null,
|
||||
isset($data['retry']) ? ['Retry-After' => $data['retry']] : []
|
||||
);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Stancl\Tenancy\Database\Concerns\MaintenanceMode;
|
||||
use Stancl\Tenancy\Middleware\CheckTenantForMaintenanceMode;
|
||||
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|
||||
use Stancl\Tenancy\Tests\Etc\Tenant;
|
||||
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
|
||||
|
||||
class MaintenanceModeTest extends TestCase
|
||||
{
|
||||
|
|
@ -32,7 +34,7 @@ class MaintenanceModeTest extends TestCase
|
|||
|
||||
$tenant->putDownForMaintenance();
|
||||
|
||||
$this->expectException(MaintenanceModeException::class);
|
||||
$this->expectException(HttpException::class);
|
||||
$this->withoutExceptionHandling()
|
||||
->get('http://acme.localhost/foo');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue