-
Notifications
You must be signed in to change notification settings - Fork 46
Description
In the dummy app the attach action for MorphToMany relations is broken and throws a LogicException: No schema for JSON:API resource type media.
Reproduction
I built a sample Laravel app from the included dummy:
https://github.com/byte-it/laravel-jsonapi-sample
A call POST api/v1/posts/{post}/relations/media then throws the mentioned error.
Cause
The LaravelJsonApi\Laravel\Routing\Route class tries to retrieve the Schema for the related model. Because the MorphToMany relation returns it "morph" name instead of resolving to a real schema name, the resolving fails.
Digging deeper it becomes apparent, that it start in the CollectionQuery that tries to resolve the rules for the filters etc.
I don't see the reason at this point why these are needed at this point because the POST request doesn't support any query parameters anyways.