*/ public function toArray($request) { return [ 'to_name' => $this->to['name'], 'sum_human' => number_format($this->positions->sum('price') / 100, 2, ',', '') . ' €', 'sent_at_human' => $this->sent_at?->format('d.m.Y') ?: '', 'status' => $this->status->value, 'via' => $this->via->value, ]; } /** * @return array */ public static function meta(): array { return [ 'links' => [ 'mass-store' => route('invoice.mass-store'), ], 'vias' => BillKind::forSelect(), 'statuses' => InvoiceStatus::forSelect(), ]; } }