document = $document; $this->requester = $requester; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { return ['mail', 'database']; } /** * Get the mail representation of the notification. */ public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->subject('Solicitud de aprobación de documento') ->greeting('Hola ' . $notifiable->name . '!') ->line($this->requester->name . ' ha solicitado tu aprobación para el documento:') ->line('**Documento:** ' . $this->document->name) ->action('Revisar Documento', route('documents.show', $this->document)) ->line('Fecha límite: ' . $this->document->due_date->format('d/m/Y')) ->line('Gracias por usar nuestro sistema!'); } /** * Get the array representation of the notification. * * @return array */ public function toArray(object $notifiable): array { return [ 'type' => 'approval-request', 'document_id' => $this->document->id, 'requester_id' => $this->requester->id, 'message' => 'Nueva solicitud de aprobación para: ' . $this->document->name, 'link' => route('documents.show', $this->document) ]; } }