Closed jamesautodude closed 9 months ago
I haven't heard anything back :/ but that's alright
For anyone else, the workaround is just to not use the above mailable example, since I guess it's not going to be fixed :/
For reference, this is how I was doing it before the package
I use the database to store my mailable templates so, this is how I do that with regular laravel:
//use helper to grab the subject from mailable table with column "mailable" as "ClientSignup" and column "subject"
$subject = emailTemplate($companyInfo->id, 'ClientSignup', 'subject');
//use helper to grab the body from mailable table with column "mailable" as "ClientSignup" and column "html_template"
$body = emailTemplate($companyInfo->id, 'ClientSignup', 'body');
Mail::to($request->email)->send(new DatabaseMailer($body, $subject));
The above Mail::to works perfectly
Based on readme I though I could do the following...
//use helper to grab the subject from mailable table with column "mailable" as "ClientSignup" and column "subject"
$subject = emailTemplate($companyInfo->id, 'ClientSignup', 'subject');
//use helper to grab the body from mailable table with column "mailable" as "ClientSignup" and column "html_template"
$body = emailTemplate($companyInfo->id, 'ClientSignup', 'body');
Email::compose()
->mailable(new DatabaseMailer($body, $subject))
->send();
Unfortunately it gives View[] not found
I will use the following for now, which isn't a bad thing... just posting for reference
//use helper to grab the subject from mailable table with column "mailable" as "ClientSignup" and column "subject"
$subject = emailTemplate($companyInfo->id, 'ClientSignup', 'subject');
//use helper to grab the body from mailable table with column "mailable" as "ClientSignup" and column "html_template"
$body = emailTemplate($companyInfo->id, 'ClientSignup', 'body');
Email::compose()
->label('welcome')
->recipient('test@gmail.com')
->subject($subject)
->view('emails.databaseTemplate')
->variables([
'body' => $body,
])
->send();
This workaround works fine
Thank you
Sorry, I can't reproduce this using fresh installs of Laravel 8, 9 or 10! Few questions:
When using:
Email::compose() ->mailable(new OrderShipped()) ->send();
I get an error of: View [] not found.