I encountered a strange bug when creating a purchase or sale in the app.
Hi friends, My multitenancy application has the logic of buying and selling, but in order to perform these actions, you need to create a warehouse. The mistake is that the warehouse created in the first company can be used in another company, but it should be so that the warehouse belongs only to the company where it was created. CompanyPurchaseResource.php (form):
2 Replies
Tell me please
Read : https://filamentphp.com/docs/3.x/panels/tenancy#tenancy-security
Form component and filter scoping. When using the Select, CheckboxList or Repeater form components, the SelectFilter, or any other similar Filament component which is able to automatically fetch "options" or other data from the database (usually using a relationship() method), this data is not scoped. The main reason for this is that these features often don't belong to the Filament Panel Builder package, and have no knowledge that they are being used within that context, and that a tenant even exists. And even if they did have access to the tenant, there is nowhere for the tenant relationship configuration to live. To scope these components, you need to pass in a query function that scopes the query to the current tenant.For example, if you were using the Select form component to select an author from a relationship, you could do this:
Then implement : https://filamentphp.com/docs/3.x/panels/tenancy#using-tenant-aware-middleware-to-apply-global-scopes