ylliX - Online Advertising Network

laravel json api polimorphic relationship

Just started using laravel-json-api this week. Currently I’m facing a problem trying to expose a MorthTo related route. Can anybody help me? my api.php file contains this resource $server->resource(‘documents’, JsonApiController::class) ->relationships(function ($relations) { $relations->hasOne(‘documentable’); }); my DocumentSchema contains this field: MorphTo::make(“documentable”)->types(“trees”, “maintenance-requests”)->withUriFieldName(‘documentavel’), my Document model contains this relationship: public function documentable(): MorphTo { return $this->morphTo(); […]