Laravel 9 has gained a https://laravel.com/docs/9.x/mail#attachable-objects. Using the Attachable interface, you can specify what should happen when an object gets used as an attachment.
Let's look at how you would attach files to Mailables in previous versions of Laravel. Imagine that your app has a simple Photo model with a path property that contains the path to the actual image file.
// in a Mailable public function __construct(public Photo $photo) { } public function build() { return $this ->view('emails.yourView') ->attach($this->photo->path); }