Closed LucasLavallee closed 2 years ago
We had the Actionable trait to our Tenant model to add the action log on our resource.
So what's the expected behavior? That the action log data would be inside the tenant DB?
If you use Actionable
on the Tenant, then it makes sense that the data will be in the central table, since tenants
is a central DB table.
Bug description
We found a bug when using the Action log functionnality of Laravel Nova (https://nova.laravel.com/docs/3.0/actions/defining-actions.html#action-log) and this package.
On our project, we are using Laravel Nova to manage tenants from our central application. We also a Laravel Nova back-office on each tenants. We had the
Actionable
trait to ourTenant
model to add the action log on our resource.From central, the action log is working properly, displaying the action log on every tenants.
From the back-office of our tenants, we have the possibility to edit some fields of the current
tenant()
. To do so, we add a custom menu link that redirect on the current tenant edit page (we have one Nova resource for the central and one for the tenants).The problem is that the data retrieved from the action log on the
Tenant
resource in our tenants seems to come from the central database and not from the current tenant linked database. It seems that Nova is retrieving the central database data because ourtenants
table is located on the central database and not in the tenant database.To avoid this behavior, we have found a way to get around it. We overide the
actions
method from theActionable
trait on ourTenant
model :Steps to reproduce
Tenant
model on the central and another one used for the tenantsTenant
modemExpected behavior
Make sure that Laravel Nova is using the current tenants
action_events
table data on the Tenant model related resourceLaravel version
8.83.23
stancl/tenancy version
3.5.9