You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I made a little hacky solution but if there is a better one please send your ones :D
added route string column to companies table with default string of 'company'
removed path as path('')
edited tenant as tenant(Company::class, 'route')
updated ConfigureCurrentCompany middleware
public function handle(Request $request, Closure $next): Response
{
/** @var Company $company */
$company = $this->getTenant();
if ($company) {
CompanyConfigured::dispatch($company);
}
return $next($request);
}
protected function getTenant(): Model
{
$tenantModel = Filament::getTenantModel();
$record = app($tenantModel)->where('domain', request()->host())->first();
if ($record === null) {
throw (new ModelNotFoundException())->setModel($tenantModel);
}
return $record;
}
And it worked, Possibly I need to re-check if some global scope need to be added as well but it is a hacky solution. Do you maybe have a better one? Thanks
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently I made a little hacky solution but if there is a better one please send your ones :D
And it worked, Possibly I need to re-check if some global scope need to be added as well but it is a hacky solution. Do you maybe have a better one? Thanks
Beta Was this translation helpful? Give feedback.
All reactions