mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Clean up some relation stuff
This commit is contained in:
parent
56932604db
commit
c1e7c00e2d
|
@ -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