can someone help me with this query why i am getting this error .
hi,
i can't fix the query to set the subject of a mail to be one from db field after $repair->save() in controller
this one works:
Mail::raw($body, function ($message) use ($user, $repair) {
$message->from(Setting::where('setting_key', 'company_email')->first()->setting_value, Setting::where('setting_key', 'company_name')->first()->setting_value);
$message->to('mail@mail.com');
$message->setContentType('text/html');
$message->setSubject(CustomFieldMeta::where('category', 'repairs')->where('parent_id', 108)->where('custom_field_id', 1)->first()->name);
});
or this one:
Mail::raw($body, function ($message) use ($user, $repair) {
$message->from(Setting::where('setting_key', 'company_email')->first()->setting_value, Setting::where('setting_key', 'company_name')->first()->setting_value);
$message->to('mail@mail.com');
$message->setContentType('text/html');
$message->setSubject($repair->id);
});
and this one witch i need is not working:
Mail::raw($body, function ($message) use ($user, $repair) {
$message->from(Setting::where('setting_key', 'company_email')->first()->setting_value, Setting::where('setting_key', 'company_name')->first()->setting_value);
$message->to('mail@mail.com');
$message->setContentType('text/html');
$message->setSubject(CustomFieldMeta::where('category', 'repairs')->where('parent_id', $repair->id)->where('custom_field_id', 1)->first()->name);
});
error: at HandleExceptions->handleError('8', 'Trying to get property of non-object', '/public_html/app/Http/Controllers/RepairController.php', '188', array('message' => object(Message), 'user' => object(User), 'repair' => object(Repair))) in RepairController.php line 188
Thank you.
via Motanul Galanton