dev-partners / laravel-nova-auditable-log

A Laravel Nova resource tool for visualizing the audit log created by the Laravel Auditing package.
51 stars 22 forks source link

Remove all global scopes instead of just trashed #34

Open JHWelch opened 9 months ago

JHWelch commented 9 months ago

Right now the loadRecord only removes the trashed global scope when it is present.

However, this causes a problem for other records with Global Scopes. It seems Nova itself will ignore these scopes when serving a detail page, so it means you can view records that then fail when you click on auditable log with the following error when the resource is not properly loaded.

Too few arguments to function Devpartners\AuditableLog\ToolServiceProvider::Devpartners\AuditableLog\{closure}(),
1 passed in {{repo}}/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 548 and exactly 2 expected

As a side effect, the withoutGlobalScopes also removes the trashed scope, so you can remove the ternary.

Let me know if you'd like me to take another approach, but I think this is fine with how Nova already works.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.