I think it should be
use Illuminate\Mail\Attachment;
Edit: Ah it is also in mailables in the newest version. Run composer update
I'm trying to send an email with pdf attachment in Laravel but I'm getting error,
My Mail is:
use Illuminate\Mail\Mailables\Attachment;
public function build(Request $request)
{
return [
Attachment::fromStorage('/brochures')
->as($request->b_code.'.pdf')
->withMime('application/pdf'),
];
}
Controller:
use Mail;
Mail::to('[email protected]')->send(new Brochure($request));
But I'm getting this error:
Class 'Illuminate\Mail\Mailable\Attachment' not found
@Sharim Then use the docs from laravel 6 and not the docs from laravel 9 https://laravel.com/docs/6.x/mail#attachments
Please or to participate in this conversation.