Closed Samoht70 closed 8 months ago
I'm not getting a crash on my side, can you confirm this is still hapenning on last commit please ?
Ok I got it, basically you are forcing a relation thats not in the relations part
Will need a bit more time to think on how to approach this
"message": "Undefined array key \"includes\"", "file": "/var/www/vendor/lomkit/laravel-rest-api/src/Http/Response.php", "line": 46,
The problem arises when there's a $with in the model, because the relationship is loaded by the $with but not by the includes field.
Laravel Rest Api Version
1.1.1
Laravel Version
10.24.0
PHP Version
8.1
Database Driver & Version
No response
Description
Error: Call to a member function resource() on null in file /var/www/vendor/lomkit/laravel-rest-api/src/Http/Response.php on line 92
This error occurs when using laravel/spatie-permission. By including roles in the User model via the variable $with because the relationship with roles is defined directly with the package, so I didn't define it in the UserResource.
Steps To Reproduce
protected $with = ['roles'];
users/search