mirror of
https://github.com/flarum/framework.git
synced 2025-03-30 11:37:28 +08:00
Update API relationship listener
This commit is contained in:
parent
f637b160fd
commit
50645c5db9
@ -59,12 +59,12 @@ class AddPostFlagsRelationship
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param GetApiRelationship $event
|
* @param GetApiRelationship $event
|
||||||
* @return \Flarum\Api\Relationship\HasManyBuilder|null
|
* @return \Tobscure\JsonApi\Relationship|null
|
||||||
*/
|
*/
|
||||||
public function getApiRelationship(GetApiRelationship $event)
|
public function getApiRelationship(GetApiRelationship $event)
|
||||||
{
|
{
|
||||||
if ($event->isRelationship(PostSerializer::class, 'flags')) {
|
if ($event->isRelationship(PostSerializer::class, 'flags')) {
|
||||||
return $event->serializer->hasMany(FlagSerializer::class, 'flags');
|
return $event->serializer->hasMany($event->model, FlagSerializer::class, 'flags');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user