首页 > 解决方案 > Laravel - {"exception":"[object] (InvalidArgumentException(code: 0): Driver [bugsnag] is not supported

问题描述

在我的 Laravel-8 应用程序中,我尝试发送多个通知:

可以有一个或多个具有管理员角色的用户。

控制器:

$hrservicesQueries            = User::role('Admin')->where('company_id', $userCompany)->get();

                foreach ($hrservicesQueries as $hrservicesQuery)
                {
                    $hrservicedetails = [
                        'sent_to' => $hrservicesQuery->id,
                        'sent_by' => $employeeId,   //$userId,
                        'subject' => 'Leave Approval for : '.$employeeFirstName,
                        'greeting' => 'Dear '.$hrservicesQuery->first_name . ' '. $hrservicesQuery->last_name . ',',
                        'body' =>  'Please note that you have a Leave request awaiting your approval (' . $employeeFirstName . ' ' .$employeeLastName. ') ',
                        'line1' => 'Please note that you have a Leave request awaiting your approval (' . $employeeFirstName . ' ' .$employeeLastName. ') ',
                        'thanks' => 'Thank you!',
                        'employee_fullname' => $employeeFirstName. ' ' . $employeeLastName,
                        'employee_code' => $employeeCode,
                        'employee_email' => $employeeEmail,
                        'employee_id' => $employeeId,
                        'hr_service_fullname' => $hrservicesQuery->first_name . ' '. $hrservicesQuery->last_name,
                        'actionText' => 'Approve/Reject Leave',
                        'actionURL' => route('leave.leave_reviews.index_hr'),
                        'hr_service_email' => $hrservicesQuery->email,
                        'hr_service_id' => $hrservicesQuery->id,
                    ];

                    Notification::route('mail', $hrservicedetails['hr_service_email'])
                        ->notify(new \App\Notifications\Leave\LineManagerToHrService($hrservicedetails));
                }

通知(LineManagerToHrService):

类 LineManagerToHrService 扩展通知实现 ShouldQueue { 使用 Queueable; 私人 $hrservicedetails;

    public function __construct($hrservicedetails)
    {
        $this->hrservicedetails = $hrservicedetails;
    }

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
//        return (new MailMessage)
            $mail = (new MailMessage)
                    ->subject($this->hrservicedetails['subject'])
                    ->greeting($this->hrservicedetails['greeting'])
                    ->line($this->hrservicedetails['line1'])
                    ->action($this->hrservicedetails['actionText'], $this->hrservicedetails['actionURL'])
                    ->line($this->hrservicedetails['thanks']);
        $this->storeNotification($mail,$notifiable);
        return $mail;
    }
}

我得到了这些错误:

App\Http\Controllers\Leave\LeaveReviewsController->leave_request_approve(Object(Illuminate\Http\Request), '189') #11 C:\xampp\htdocs\myapp\vendor\laravel\framework\src\Illuminate\Notifications\NotificationSender.php(103): Illuminate\Notifications\NotificationSender->sendToNotifiable(Object(Illuminate\Notifications\AnonymousNotifiable), 'c4180551 -29f8-4...', Object(App\Notifications\Leave\LineManagerToHrService), 'mail') #12 C:\xampp\htdocs\myapp\vendor\laravel\framework\src\Illuminate\Support\Traits\Localizable .php(19): Illuminate\Notifications\NotificationSender->Illuminate\Notifications{closure}() #13 C:\xampp\htdocs\myapp\vendor\laravel\framework\src\Illuminate\Notifications\NotificationSender.php(105) : Illuminate\Notifications\NotificationSender->withLocale(NULL, Object(Closure)) #14 C:\xampp\htdocs\myapp\vendor\laravel\framework\src\Illuminate\Notifications\ChannelManager.php(54): Illuminate\Notifications \NotificationSender->sendNow(数组,对象(App\Notifications\Leave\LineManagerToHrService),数组)

当我 dd($hrservicesQueries);

我懂了:

我的应用

我该如何解决?

谢谢

标签: laravel

解决方案


推荐阅读