Edit File: SendAdminNotification.php
<?php namespace App\Jobs; use Illuminate\Queue\{SerializesModels, InteractsWithQueue}; use Illuminate\Support\Facades\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Bus\Queueable; use App\Models\Admin; class SendAdminNotification implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public $model; public $notificationClass; public $title_ar; public $title_en; public $body_ar; public $body_en; public $type; public function __construct($model, string $notificationClass, string $title_ar, string $title_en, string $body_ar, string $body_en, $type) { $this->model = $model; $this->notificationClass = $notificationClass; $this->title_ar = $title_ar; $this->title_en = $title_en; $this->body_ar = $body_ar; $this->body_en = $body_en; $this->type = $type; } public function handle() { $admins = Admin::all(); if ($admins->isEmpty()) { return; } $notification = new $this->notificationClass( $this->model, $this->title_ar, $this->title_en, $this->body_ar, $this->body_en, $this->type ); Notification::send($admins, $notification); } }
Back to File Manager