Clean up some relation stuff

This commit is contained in:
Toby Zerner 2015-07-01 22:35:56 +09:30
parent 56932604db
commit c1e7c00e2d
3 changed files with 4 additions and 2 deletions

View File

@ -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');

View File

@ -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,

View File

@ -34,6 +34,8 @@ trait Locked
return $can;
}
}
return false;
}
/**