Edit File: OrderNotification.php
<?php namespace App\Notifications; use App\Models\NegotiationOrder; use App\Models\Order; use App\Traits\FirebaseTrait; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Schema; class OrderNotification extends Notification { use Queueable, FirebaseTrait; protected $receiver, $data; public function __construct($order, $type) { $hasPayType = Schema::hasColumn($order->getTable(), 'pay_type'); $hasPayStatus = Schema::hasColumn($order->getTable(), 'pay_status'); if ($hasPayType && $hasPayStatus) { $this->data['pay_type'] = $order->pay_type; $this->data['pay_status'] = $order->pay_status; } $this->data = [ 'order_id' => $order->id, 'order_num' => $order->order_num, 'type' => $type, 'order_type' => get_class($order) == Order::class ? 'order' : (get_class($order) == NegotiationOrder::class ? 'negotiation' : 'settlement'), ]; } public function via($notifiable) { return ['database']; } public function toArray($notifiable) { if ($notifiable->is_notify) { $this->sendFcmNotification($notifiable->devices(), $this->data, $notifiable->lang ?? 'ar'); } return $this->data; } }
Back to File Manager