public function __construct($data = []) { parent::__construct($data); if (empty($this->pass)) { $this->setPass(self::generateRandomString(4)); } }
public function toArray() { $data = parent::toArray(); if ($this->birthDay instanceof \DateTime) { $data['birthDay'] = $this->birthDay->format('Y-m-d'); } return $data; }
public function toArray() { $data = parent::toArray(); $data['start'] = isset($this->start) ? $this->start->format('Y-m-d H:i:s') : ''; $data['end'] = isset($this->end) ? $this->end->format('Y-m-d H:i:s') : ''; $data['client'] = isset($this->client) ? $this->client->toArray() : []; $data['title'] = isset($this->orderId) ? $this->orderId : ''; return $data; }