productionOrder = $productionOrder; $this->creatorName = $creatorName; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { return ['database']; } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'type' => 'production_order', 'action' => 'created', 'production_order_id' => $this->productionOrder->id, 'code' => $this->productionOrder->code, 'creator_name' => $this->creatorName, 'message' => "{$this->creatorName} 建立了新的生產工單:{$this->productionOrder->code}", 'link' => route('production-orders.index', ['search' => $this->productionOrder->code]), ]; } }