mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:14:03 +00:00
drop laravel < 9 support
This commit is contained in:
parent
eca3b79118
commit
89c5029fd6
7 changed files with 20 additions and 32 deletions
|
|
@ -1,4 +1,4 @@
|
|||
ARG PHP_VERSION=7.4
|
||||
ARG PHP_VERSION=8.1
|
||||
ARG PHP_TARGET=php:${PHP_VERSION}-cli
|
||||
|
||||
FROM ${PHP_TARGET}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
"php": "^8.0",
|
||||
"ext-json": "*",
|
||||
"illuminate/support": "^9.0|^10.0",
|
||||
"facade/ignition-contracts": "^1.0",
|
||||
"ramsey/uuid": "^3.7|^4.0",
|
||||
"stancl/jobpipeline": "^1.0",
|
||||
"stancl/virtualcolumn": "^1.0"
|
||||
"facade/ignition-contracts": "^1.0.2",
|
||||
"ramsey/uuid": "^4.7.3",
|
||||
"stancl/jobpipeline": "^1.6.2",
|
||||
"stancl/virtualcolumn": "^1.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/framework": "^9.0|^10.0",
|
||||
"orchestra/testbench": "^7.0|^8.0",
|
||||
"league/flysystem-aws-s3-v3": "^1.0|^3.0",
|
||||
"doctrine/dbal": "^2.10",
|
||||
"spatie/valuestore": "^1.2.5"
|
||||
"league/flysystem-aws-s3-v3": "^3.12.2",
|
||||
"doctrine/dbal": "^2.13.9",
|
||||
"spatie/valuestore": "^1.3.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
@ -50,5 +50,10 @@
|
|||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,14 +63,11 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
|
|||
static::initializeTenancyForQueue($event->job->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
|
||||
if (version_compare(app()->version(), '8.64', '>=')) {
|
||||
// JobRetryRequested only exists since Laravel 8.64
|
||||
$dispatcher->listen(JobRetryRequested::class, function ($event) use (&$previousTenant) {
|
||||
$previousTenant = tenant();
|
||||
$dispatcher->listen(JobRetryRequested::class, function ($event) use (&$previousTenant) {
|
||||
$previousTenant = tenant();
|
||||
|
||||
static::initializeTenancyForQueue($event->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
}
|
||||
static::initializeTenancyForQueue($event->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
|
||||
// If we're running tests, we make sure to clean up after any artisan('queue:work') calls
|
||||
$revertToPreviousState = function ($event) use (&$previousTenant, $runningTests) {
|
||||
|
|
|
|||
|
|
@ -46,11 +46,7 @@ class PostgreSQLSchemaManager implements TenantDatabaseManager
|
|||
|
||||
public function makeConnectionConfig(array $baseConfig, string $databaseName): array
|
||||
{
|
||||
if (version_compare(app()->version(), '9.0', '>=')) {
|
||||
$baseConfig['search_path'] = $databaseName;
|
||||
} else {
|
||||
$baseConfig['schema'] = $databaseName;
|
||||
}
|
||||
$baseConfig['search_path'] = $databaseName;
|
||||
|
||||
return $baseConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,10 +207,6 @@ class BootstrapperTest extends TestCase
|
|||
$disk = Storage::disk($disk);
|
||||
$adapter = $disk->getAdapter();
|
||||
|
||||
if (! Str::startsWith(app()->version(), '9.')) {
|
||||
return $adapter->getPathPrefix();
|
||||
}
|
||||
|
||||
$prefixer = (new ReflectionObject($adapter))->getProperty('prefixer');
|
||||
$prefixer->setAccessible(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ class ViteBundlerTest extends TestCase
|
|||
/** @test */
|
||||
public function the_vite_helper_uses_our_custom_class()
|
||||
{
|
||||
if (version_compare(app()->version(), '9.0', '<')) {
|
||||
$this->markTestSkipped('Vite is only used in Laravel 9+');
|
||||
}
|
||||
|
||||
$vite = app(\Illuminate\Foundation\Vite::class);
|
||||
|
||||
$this->assertInstanceOf(\Illuminate\Foundation\Vite::class, $vite);
|
||||
|
|
|
|||
|
|
@ -194,9 +194,7 @@ class TenantDatabaseManagerTest extends TestCase
|
|||
]);
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
$schemaConfig = version_compare(app()->version(), '9.0', '>=') ?
|
||||
config('database.connections.' . config('database.default') . '.search_path') :
|
||||
config('database.connections.' . config('database.default') . '.schema');
|
||||
$schemaConfig = config('database.connections.' . config('database.default') . '.search_path');
|
||||
|
||||
$this->assertSame($tenant->database()->getName(), $schemaConfig);
|
||||
$this->assertSame($originalDatabaseName, config(['database.connections.pgsql.database']));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue