Skip to content

Error searchQuery when using laravel/spatie-permission #48

@Samoht70

Description

@Samoht70

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

  • Add laravel/spatie-permission
  • Set-up roles/permissions migrations
  • Add $with in model User protected $with = ['roles'];
  • Try to use search method users/search

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions