data = clone $data; } /** * Get the message envelope. * * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): \Illuminate\Mail\Mailables\Envelope { return new Envelope( from: new Address(\config('mail.from.address'), \config('mail.from.name')), subject: sprintf('%s - %s', ObjectEnum::make($this->data->type)->label() ?? __('Nouveau message'), config('app.name')), replyTo: [new Address( $this->data->email, sprintf('%s %s', $this->data->first_name, $this->data->last_name) )], ); } /** * Get the message content definition. * * @return \Illuminate\Mail\Mailables\Content */ public function content(): \Illuminate\Mail\Mailables\Content { return new Content( markdown: 'emails.send-contact-form', with: ['data' => $this->data], ); } /** * Get the attachments for the message. * * @return array */ public function attachments(): array { $attachments = []; if (isset($this->data->file)) { $attachments[] = Attachment::fromPath($this->data->file->getRealPath()) ->as($this->data->file->getClientOriginalName()) ->withMime($this->data->file->getClientMimeType()); } return $attachments; } } /** * @property \App\Enums\Contact\ObjectEnum $type * @property string|null $first_name * @property string $last_name * @property string|null $phone * @property string $email * @property string|null $address * @property string|null $city * @property string|null $postal_code * @property string $message * @property boolean $terms * @property \Illuminate\Http\UploadedFile|null $file * @property \App\Models\Product|null $product * @property \Carbon\Carbon|null $expiration_date * @property integer|null $batch_number * @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses */ class Contact extends \stdClass { }