Skip to content

Third-party packages conflicts with trafficCop  #5638

@beshoo

Description

@beshoo

Summary
When using the serenysoft/nova-permissions package along with Laravel Nova, updating resources inside the Nova dashboard fails with the error message: "Another user has updated this resource since this page was loaded. Please refresh the page and try again."

This issue occurs browser time zones are NOT in sync with the server (That is what Nova support responds to me).

Steps to Reproduce
Install the serenysoft/nova-permissions package in a Laravel Nova project.
Create a resource and attach permission to it using the serenysoft/nova-permissions package.
Attempt to update the resource permission inside the Nova dashboard.

The update will fail with the error message: "Another user has updated this resource since this page was loaded. Please refresh the page and try again."

Expected Behavior
The update should be successful without any error messages.

Actual Behavior
The update fails with the error message: "Another user has updated this resource since this page was loaded. Please refresh the page and try again."

Environment
Laravel Version:10
Nova Version: 4.x
serenysoft/nova-permissions Package
Server Timezone: UTC
MySQL Timezone: UTC
Laravel Timezone in app.php: UTC
Browser Timezne: Unknown

Workaround
Disabling the trafficCop feature by setting public static $trafficCop = false; in app/Nova/Resources.php resolves the issue for resources defined in the app/Nova directory.

However, this solution does not work for resources defined in the serenysoft/nova-permissions package, which has its own vendor/sereny/nova-permissions/src/Nova/Resource.php file that extends the main vendor/laravel/nova/src/Resource.php file. which means it ignores "app/Nova/Resources.php" altogether.
Any plugin may have this method of OOP and we can not follow all plugins!

Despite updating the plugin to solve the problem but any time I do composer update , all my modifications will be lost.

Expected Solution
I suggest adding a configuration flag in Laravel Nova's configuration file that can be used to disable the trafficCop feature globally. This will allow users to use third-party packages like serenysoft/nova-permissions without encountering conflicts with the trafficCop feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions