1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 18:24:04 +00:00

Minor fixes for using the package in an app

This commit is contained in:
Samuel Štancl 2020-05-16 11:56:32 +02:00
parent 1833622170
commit 7a7200fd25
4 changed files with 16 additions and 14 deletions

View file

@ -110,11 +110,9 @@ class TenancyServiceProvider extends ServiceProvider
protected function mapRoutes() protected function mapRoutes()
{ {
$this->app->booted(function () {
if (file_exists(base_path('routes/tenant.php'))) { if (file_exists(base_path('routes/tenant.php'))) {
Route::namespace($this->app['config']['tenancy.tenant_route_namespace'] ?? 'App\Http\Controllers') Route::namespace($this->app['config']['tenancy.tenant_route_namespace'] ?? 'App\Http\Controllers')
->group(base_path('routes/tenant.php')); ->group(base_path('routes/tenant.php'));
} }
});
} }
} }

View file

@ -176,13 +176,20 @@ return [
// Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancy.samuelstancl.me/docs/v2/features/tenant-redirect/ // Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancy.samuelstancl.me/docs/v2/features/tenant-redirect/
], ],
/**
* Parameters used by the tenants:migrate command.
*/
'migration_parameters' => [ 'migration_parameters' => [
'--force' => true, // Set this to true to be able to run migrations in production '--force' => true, // This needs to be true to run migrations in production.
'--path' => [database_path('migrations/tenant')], '--path' => [database_path('migrations/tenant')],
'--realpath' => true,
], ],
/**
* Parameters used by the tenants:seed command.
*/
'seeder_parameters' => [ 'seeder_parameters' => [
'--class' => 'DatabaseSeeder', // root seeder class, e.g.: 'DatabaseSeeder' '--class' => 'DatabaseSeeder', // root seeder class
// '--force' => true, // '--force' => true,
], ],
]; ];

View file

@ -22,10 +22,7 @@ class Domain extends Model implements Contracts\Domain
{ {
use CentralConnection; use CentralConnection;
public $guarded = []; protected $guarded = [];
public $casts = [
'is_primary' => 'bool',
];
public static function booted() public static function booted()
{ {

View file

@ -26,8 +26,8 @@ class Tenant extends Model implements Contracts\Tenant
} }
protected $table = 'tenants'; protected $table = 'tenants';
public $primaryKey = 'id'; protected $primaryKey = 'id';
public $guarded = []; protected $guarded = [];
public function getTenantKeyName(): string public function getTenantKeyName(): string
{ {