requisition = $requisition; $this->action = $action; $this->actorName = $actorName; } public function via(object $notifiable): array { return ['database']; } public function toArray(object $notifiable): array { $messages = [ 'submitted' => "{$this->actorName} 提交了叫貨申請:{$this->requisition->doc_no}", 'approved' => "{$this->actorName} 核准了叫貨申請:{$this->requisition->doc_no}", 'rejected' => "{$this->actorName} 駁回了叫貨申請:{$this->requisition->doc_no}", ]; return [ 'type' => 'store_requisition', 'action' => $this->action, 'store_requisition_id' => $this->requisition->id, 'doc_no' => $this->requisition->doc_no, 'actor_name' => $this->actorName, 'message' => $messages[$this->action] ?? "{$this->actorName} 操作了叫貨申請:{$this->requisition->doc_no}", 'link' => route('store-requisitions.show', $this->requisition->id), ]; } }