Closed miguelurtado closed 11 months ago
@danharrin I have the same issue. But I don't understand how to handle it properly.
Since I use ComputerSoftware
for counting, I need to scope it to the current tenant.
Tenant 1
(Model) Computer 1 (with tenant_id)
(Model) Software 1 (with tenant_id)
(Join table) ComputerSoftware (with tenant_id)
Tenant 2
(Model) Computer 2 (with tenant_id)
(Model) Software 2 (with tenant_id)
(Join table) ComputerSoftware (with tenant_id)
From my understanding in your last comment, this is not possible. Would that be possible with a hook that sets tenant_id before saving the ComputerSoftware record?
Thank you!
It is possible, we just dont do it automatically.
createOptionAction(fn ($action) => $action->mutateFormDataUsing(function () {
// set tenant in $data
return $data;
}))
Package
filament/filament
Package Version
v3.0.80
Laravel Version
v10.28.0
Livewire Version
v3.0.10
PHP Version
PHP 8.2.11
Problem description
Creating a new option in a modal not work with tenancy - createOptionForm
Expected behavior
The team_id automatically added.
Steps to reproduce
Create on select field using createOptionForm. Exemple in repository DepartmentResource.
Reproduction repository
https://github.com/miguelurtado/filament_tenancy
Relevant log output