getRouteKey(); } public function title() { if ($this->title != '') { return $this->title; } if ($this->name != '') { return $this->name; } return 'None'; } public function toArray() { return [ 'id' => $this->getRouteKey(), 'title' => $this->title(), 'invoice_number' => $this->invoice_number, 'restaurant_id' => $this->restaurant_id, 'pay_period_type' => $this->pay_period_type, 'debit' => $this->debit, 'credit' => $this->credit, 'payment_due' => $this->payment_due, 'status' => $this->status, 'pay_period_start' => $this->pay_period_start, 'pay_period_end' => $this->pay_period_end, 'description' => $this->description, 'total_orders' => $this->total_orders, 'cancelled_orders' => $this->cancelled_orders, 'refund_orders' => $this->refund_orders, 'PRIMARY' => $this->PRIMARY, 'created_at' => !is_null($this->created_at) ? $this->created_at->format('Y-m-d H:i:s') : null, 'updated_at' => !is_null($this->updated_at) ? $this->updated_at->format('Y-m-d H:i:s') : null, 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), ], ]; } }