Allow resources to bypass tenancy

With tenancy in place, is it possible to allow certain resources to bypass tenancy (i.e. be available to all users, regardless of their tenant)?
5 Replies
Andrew Wallo
Andrew Wallo16mo ago
No not right now I don't think.
lancodev
lancodevOP16mo ago
I guess I could just override the getEloquentQuery method on the resource
Andrew Wallo
Andrew Wallo16mo ago
Well the tenant ID is still attatched to the url so I think the user would still have to belong to the tenant Because any user who doesnt belong to the tenant would have a 404
lancodev
lancodevOP16mo ago
Gotcha, yeah good point.
nicko170
nicko17016mo ago
This works perfectly @lancodev
public static function getEloquentQuery(): Builder
{
// Bypass tenant middleware for this
return static::getModel()::query();
}
public static function getEloquentQuery(): Builder
{
// Bypass tenant middleware for this
return static::getModel()::query();
}
Stick that on the resource. I don't allow create / edit of them etc, and the modal to request more added to the global table doesn't use filament to save the response - so it works.
Want results from more Discord servers?
Add your server