public function toArray() { $array = parent::toArray(); if (isset($this->category->id) && $this->category->id) { $array['category_id'] = $this->category->id; } if (isset($this->user) && $this->user->id) { $array['user_id'] = $this->user->id; } if (!$this->is_published) { $array['is_published'] = 0; } return $array; }
public function __construct($options = null) { parent::__construct($options); }