mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:54:03 +00:00
Fix styling
This commit is contained in:
parent
68846f34d1
commit
9edf139be0
21 changed files with 9 additions and 53 deletions
|
|
@ -13,7 +13,6 @@ class CacheManager extends BaseCacheManager
|
||||||
*
|
*
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function __call($method, $parameters)
|
public function __call($method, $parameters)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ class Install extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ class Migrate extends MigrateCommand
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ final class MigrateFresh extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,6 @@ class Rollback extends RollbackCommand
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ class Run extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ class Seed extends SeedCommand
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ class TenantList extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ trait HasATenantsOption
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array_merge([
|
return array_merge([
|
||||||
['tenants', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '', null],
|
['tenants', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_OPTIONAL, '', null],
|
||||||
], parent::getOptions());
|
], parent::getOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,18 +20,11 @@ interface TenantDatabaseManager
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does a database exist.
|
* Does a database exist.
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function databaseExists(string $name): bool;
|
public function databaseExists(string $name): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a DB connection config array.
|
* Make a DB connection config array.
|
||||||
*
|
|
||||||
* @param array $baseConfig
|
|
||||||
* @param string $databaseName
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function makeConnectionConfig(array $baseConfig, string $databaseName): array;
|
public function makeConnectionConfig(array $baseConfig, string $databaseName): array;
|
||||||
|
|
||||||
|
|
@ -39,9 +32,6 @@ interface TenantDatabaseManager
|
||||||
* Set the DB connection that should be used by the tenant database manager.
|
* Set the DB connection that should be used by the tenant database manager.
|
||||||
*
|
*
|
||||||
* @throws NoConnectionSetException
|
* @throws NoConnectionSetException
|
||||||
*
|
|
||||||
* @param string $connection
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function setConnection(string $connection): void;
|
public function setConnection(string $connection): void;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@ trait TenantRun
|
||||||
/**
|
/**
|
||||||
* Run a callback in this tenant's context.
|
* Run a callback in this tenant's context.
|
||||||
* Atomic, safely reverts to previous context.
|
* Atomic, safely reverts to previous context.
|
||||||
*
|
|
||||||
* @param callable $callback
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function run(callable $callback)
|
public function run(callable $callback)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,6 @@ class DatabaseConfig
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate DB name, username & password and write them to the tenant model.
|
* Generate DB name, username & password and write them to the tenant model.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function makeCredentials(): void
|
public function makeCredentials(): void
|
||||||
{
|
{
|
||||||
|
|
@ -113,7 +111,8 @@ class DatabaseConfig
|
||||||
$templateConnection = config("database.connections.{$template}");
|
$templateConnection = config("database.connections.{$template}");
|
||||||
|
|
||||||
return $this->manager()->makeConnectionConfig(
|
return $this->manager()->makeConnectionConfig(
|
||||||
array_merge($templateConnection, $this->tenantConfig()), $this->getName()
|
array_merge($templateConnection, $this->tenantConfig()),
|
||||||
|
$this->getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class UserImpersonation implements Feature
|
||||||
*
|
*
|
||||||
* @param string|ImpersonationToken $token
|
* @param string|ImpersonationToken $token
|
||||||
* @param int $ttl
|
* @param int $ttl
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public static function makeResponse($token, int $ttl = null): RedirectResponse
|
public static function makeResponse($token, int $ttl = null): RedirectResponse
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ class InitializeTenancyByDomain extends IdentificationMiddleware
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
return $this->initializeTenancy(
|
return $this->initializeTenancy(
|
||||||
$request, $next, $request->getHost()
|
$request,
|
||||||
|
$next,
|
||||||
|
$request->getHost()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ class InitializeTenancyByDomainOrSubdomain
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,9 @@ class InitializeTenancyByPath extends IdentificationMiddleware
|
||||||
// simply injected into some route controller action.
|
// simply injected into some route controller action.
|
||||||
if ($route->parameterNames()[0] === PathTenantResolver::$tenantParameterName) {
|
if ($route->parameterNames()[0] === PathTenantResolver::$tenantParameterName) {
|
||||||
return $this->initializeTenancy(
|
return $this->initializeTenancy(
|
||||||
$request, $next, $route
|
$request,
|
||||||
|
$next,
|
||||||
|
$route
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new RouteIsMissingTenantParameterException;
|
throw new RouteIsMissingTenantParameterException;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@ class InitializeTenancyByRequestData extends IdentificationMiddleware
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ class InitializeTenancyBySubdomain extends InitializeTenancyByDomain
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,6 @@ abstract class CachedTenantResolver implements TenantResolver
|
||||||
/**
|
/**
|
||||||
* Get all the arg combinations for resolve() that can be used to find this tenant.
|
* Get all the arg combinations for resolve() that can be used to find this tenant.
|
||||||
*
|
*
|
||||||
* @param Tenant $tenant
|
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
abstract public function getArgsForTenant(Tenant $tenant): array;
|
abstract public function getArgsForTenant(Tenant $tenant): array;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ class Tenancy
|
||||||
/**
|
/**
|
||||||
* Initializes the tenant.
|
* Initializes the tenant.
|
||||||
* @param Tenant|int|string $tenant
|
* @param Tenant|int|string $tenant
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function initialize($tenant): void
|
public function initialize($tenant): void
|
||||||
{
|
{
|
||||||
|
|
@ -106,9 +105,6 @@ class Tenancy
|
||||||
/**
|
/**
|
||||||
* Run a callback in the central context.
|
* Run a callback in the central context.
|
||||||
* Atomic, safely reverts to previous context.
|
* Atomic, safely reverts to previous context.
|
||||||
*
|
|
||||||
* @param callable $callback
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function central(callable $callback)
|
public function central(callable $callback)
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +128,6 @@ class Tenancy
|
||||||
* More performant than running $tenant->run() one by one.
|
* More performant than running $tenant->run() one by one.
|
||||||
*
|
*
|
||||||
* @param Tenant[]|\Traversable|string[]|null $tenants
|
* @param Tenant[]|\Traversable|string[]|null $tenants
|
||||||
* @param callable $callback
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function runForMultiple($tenants, callable $callback)
|
public function runForMultiple($tenants, callable $callback)
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Register services.
|
* Register services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function register(): void
|
public function register(): void
|
||||||
{
|
{
|
||||||
|
|
@ -76,8 +74,6 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap services.
|
* Bootstrap services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue