/** * check if input exist then prepare the relation object and assign it to the array * * @param $relations * * @return array */ public function writerRelations($relations) { $result = []; if (isset($relations['writer'])) { $result = ['writer' => $this->writers->findBy('id', $relations['writer'])]; } return $result; }