-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Hey,
would support for multi-tenancy be something you'd add for v2?
In v1 this is a bit hacky. I need to overwrite the initial migration, the table and storage path. I just checked out v2, but I don't see an easy way to tap into the code to add this functionality.
The main issue is that bootOrbital() ran before middlewares so no tenants are identified.
My code for v1:
public function migrate()
{
// Migrate central
static::$orbitalPath = base_path('storage/app/pages');
$this->setTable('pages');
$this->parentMigrate();
// Migrate Tenants
$i = 1;
while (file_exists($path = base_path('storage/tenant'.$i.'/app/pages'))) {
static::$orbitalPath = $path;
$this->setTable('pages_'.$i);
$this->parentMigrate();
$i++;
}
}
public function getTable(): string
{
return $this->table ?? (tenant() === null ? 'pages' : 'pages_'.tenant()->id);
}
public static function getOrbitalPath()
{
return static::$orbitalPath ?? storage_path('app/pages').DIRECTORY_SEPARATOR.static::getOrbitalName();
}Metadata
Metadata
Assignees
Labels
No labels