Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
see, i create a CacheServiceProvider with php artisan make:provider CacheServiceProvider...
in boot()
{
Cache::extend('redis_tenancy', function ($app) {
if (PHP_SAPI === 'cli') {
$uuid = $app['config']['driver'];
} else {
// ok, this is basically a hack to set the redis cache store
// prefix to the UUID of the current website being called
$fqdn = request()->getHost();
$uuid = DB::table('hostnames')
->select('websites.uuid')
->join('websites', 'hostnames.website_id', '=', 'websites.id')
->where('fqdn', $fqdn)
``` ->value('uuid');
}
return Cache::repository(new RedisStore(
$app['redis'],
$uuid,
$app['config']['cache.stores.redis.connection']
));
});
}
in config/cache.php edit the redis to
the problem for example is... if i put manually 1 tenant in maintenance mode in database... i need delete cache to refresh and see the tenant 2 for example in maintenance mode... and delete the date in database and clean again
to see online the tenant again.
else i use the comand tenancy:down -tenant=2... all tenants are offline..
Helloo! im having problem with a cache..
see, i create a CacheServiceProvider with php artisan make:provider CacheServiceProvider...
'redis' => [ 'driver' => 'redis_tenancy', 'connection' => 'default', ],