public function timestamps() { if (is_null($this->createdAt)) { $this->createdAt = new \DateTime(); } $this->updatedAt = new \DateTime(); }