mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Clean up some relation stuff
This commit is contained in:
parent
659ca692e3
commit
09d1c4d8ed
|
@ -55,7 +55,7 @@ abstract class BaseSerializer extends SerializerAbstract
|
|||
$data = $relation($model, $include);
|
||||
} else {
|
||||
if ($include) {
|
||||
$data = $model->getRelation($relation);
|
||||
$data = $model->$relation;
|
||||
} elseif ($many) {
|
||||
$relationIds = $relation.'_ids';
|
||||
$data = isset($model->$relationIds) ? $model->$relationIds : $model->$relation()->lists('id');
|
||||
|
|
|
@ -13,7 +13,7 @@ class DiscussionSerializer extends DiscussionBasicSerializer
|
|||
$attributes = parent::attributes($discussion);
|
||||
|
||||
$user = $this->actor->getUser();
|
||||
$state = $discussion->stateFor($user);
|
||||
$state = $discussion->state;
|
||||
|
||||
$attributes += [
|
||||
'commentsCount' => (int) $discussion->comments_count,
|
||||
|
|
|
@ -34,6 +34,8 @@ trait Locked
|
|||
return $can;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user