Closed felixele217 closed 1 year ago
Did you check both documentations? Did you remove 0
and tested it again?
How can we reproduce this?
How you pass the object to frontend? Do you use api resource which is created by php artisan make:resource
.
It is possible to that converting the object to json may be differs when it is handled by laravel.
As I see, in your frontend root object which is auth is an object. But in your backend it is an array.
you can use API Resource
Hey there,
We're closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this problem.
Hey guys,
for managing permission and roles we are using the awesome laravel-permission package from Spatie.
When we send a User-Model to the frontend (we are using react), we want roles.permissions to be attached always.
Therefore we added the following to our User-Model:
If we inspect with React Devtools in Frontend, we see the following:
Now we wrote the following test to assert, that this is happening properly:
But the test fails and says the following:
And if we dd() the response we see this:
Somehow the permissions are not loaded with the roles but seperate in the test. Is this functionality missing for the Inertia-Testing feature or am I doing it wrong somehow?
Any help appreciated! Greetings Felix