orchidsoftware / crud

Simplify the process of building CRUD (Create, Read, Update, Delete) functionality in Laravel using the features of Orchid.
https://orchid.software
MIT License
137 stars 34 forks source link

Pass correct models to policy methods when listing resources #77

Closed giant-robot closed 1 year ago

giant-robot commented 2 years ago

Closes https://github.com/orchidsoftware/crud/issues/76

tabuna commented 2 years ago

Hi @giant-robot Can you please add a simple test for this?

giant-robot commented 2 years ago

@tabuna I am seeing an issue with the test.

When the policy allows the user to access the list screen (viewAny returns true), the system attempts to fetch data from the roles table and PHPUnit subsequently fails because the table is not there.

I can't think of a way to test that the policy methods are indeed passed the right arguments without allowing access to the list screen and adding platform tables to the test environment seems like a deeper change than the scope of this PR.

How would you like to proceed?