nanadjei2's avatar

Laravel Multi-Tenancy

I am working on a multi-tenancy project and I intend to use "stancl/tenancy" package. I am planning on seeding my Tenants' database. Everything works successfully without any errors in my console but The tenants' databases are not created. This is inside of my run method of the "TenantSeeder" class.

public function run(Tenant $tenant): void
 {
    $tenants = [
        ['id' => 'fic', 'email' => '[email protected]', 'name' => 'faith house', 'domain' => 'fic.localhost'],
        ['id' => 'hofm_central_church', 'email' => '[email protected]', 'name' => 'hofm central church', 'domain' => 'hofm_central_church.localhost']
    ];

    foreach ($tenants as $tenantData) {
        $newTenant = $tenant::create([
            'id' => $tenantData['id'],
            'name' => $tenantData['name'],
            // 'tenancy_db_username' => $tenantData['email'],
            // 'tenancy_db_password' => bcrypt('password')
        ]);

        // Create the tenant database
        $newTenant->domains()->create(['domain' => $tenantData['domain']]);
    }
}

Inside of my terminal

    $php artisan migrate:fresh --seed
0 likes
0 replies

Please or to participate in this conversation.