multi-tenant
multi-tenant copied to clipboard
Ability to register tenant migration path on runtime.
Related to PR #598, would to request a feature to register custom migration path but via runtime.
ATM, my work around is via custom registrar class.
namespace App\Services;
class TenancyMigration
{
public function register($path)
{
$paths = config('tenancy.db.tenant-migrations-path');
$paths = collect($paths)->push($path)->toArray();
config()->set('tenancy.db.tenant-migrations-path', $paths);
}
}
Inside the module provider, inject the class and register the path.
/**
* Boot the application events.
*
* @param \App\Services\TenancyMigration $migration
* @return void
*/
public function boot(TenancyMigration $migration)
{
$migration->register(__DIR__ . '/../Database/Migrations');
}
TIA
I'm completely open for a PR related to this :)