/** * Send mail to user. * * @param Ad $ad * @param Request $request * * @return bool */ protected function sendMailToUser(Ad $ad, BaseRequest $request) { $mailer = new AdMail(); $dataSubject = ['ad_title' => $ad->content->title, 'website_title' => setting()->website_title]; $dataMessage = ['message' => $request->message, 'sender_name' => $request->name, 'sender_email' => $request->email, 'sender_phone' => $request->phone, 'ad_title' => $ad->content->title, 'website_title' => setting()->website_title, 'ad_url' => route('ad.show', [$ad->id, str_slug($ad->content->title)])]; return $mailer->user()->contactUser($ad->user, ['data' => $dataMessage], $dataSubject); }
protected function sendMail($event, $action, $is_user_mail, $is_admin_mail) { $mailer = new AdMail(); $role = Role::whereName('root')->firstOrFail(); $admin = $role->admins->first(); $data = ['ad' => $event->ad]; if ($is_admin_mail) { $mailer->admin()->{$action}($admin, $data); } if ($is_user_mail) { $mailer->user()->{$action}($event->ad->user, $data); } }