mailboxEnvelope( MailPurpose::BILLING, __('orders.mail_subject', ['number' => $this->order->uuid ?? $this->order->id]), ); } public function content(): Content { return new Content(view: 'mail.order-confirmation', with: [ 'name' => $this->name, 'order' => $this->order, // Through the model, so the cart, the invoice list and this mail // cannot each invent their own wording for the same row. 'label' => $this->order->label(), 'amount' => $this->amount(), 'location' => $this->location(), 'invoicesUrl' => route('invoices'), ]); } /** The charge, formatted where the currency is known rather than in a view. */ private function amount(): string { return number_format($this->order->amount_cents / 100, 2, ',', '.') .' '.strtoupper((string) $this->order->currency); } private function location(): string { $datacenter = \App\Models\Datacenter::query() ->where('code', $this->order->datacenter) ->first(); if ($datacenter === null) { return (string) $this->order->datacenter; } return $datacenter->facility ? $datacenter->name.' · '.$datacenter->facility : $datacenter->name; } }