SmokeTM
11 months ago

Wanna save created_to seperate field

Posted 11 months ago by SmokeTM

In my model Article I wanna save $this->created_at to an seperate field, but I get 0. This method gets triggered every time a new model is saved or updated.

public function toSearchableArray()
   {
       $record = $this->toArray();

       $record['created_at_seconds'] = time() - strtotime($this->created_at);

       return $record;
   }

Please sign in or create an account to participate in this conversation.