Laravel 5.5.28
I'm using a Laravel's On Demand Notification to send out an email of a simple form submission to a central address. I have followed the laravel docs here
I have mailtrap set up in the env file.
The code in my controller:
use Notification // set at top of class
$submission = FormSubmission::create($request->all());
Notification::route('mail', 'test@test.org')
->notify(new FormSubmissionNotificiation($submission));
but get a whoops error. It fails on the vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php
in this method
protected function setGlobalAddress($mailer, array $config, $type)
{
$address = Arr::get($config, $type);
if (is_array($address) && isset($address['address'])) {
$mailer->{'always'.Str::studly($type)}($address['address'], $address['name']);
}
}
where it's trying to find the $address['name']
index. But I don't have a name, and if I did, where do I put it?
Can't seem to figure it out, any help appreciated.
EDIT:
I've tried this a different way. I added in a user to my database, and added the Notifiable
trait onto the User
model and attempted to send out a notification like
$user->notify(new FormSubmissionNotification($submission);
and still got the same error.