text("Wnioski oczekujące na Twoją akcję - stan na dzień {$this->day->toDisplayString()}:") ->withAttachment(new VacationRequestsAttachment($this->vacationRequests)); } public function toMail(Notifiable $notifiable): MailMessage { $url = route( "vacation.requests.indexForApprovers", [ "status" => "waiting_for_action", ], ); return $this->buildMailMessage($notifiable, $url); } protected function buildMailMessage(Notifiable $notifiable, string $url): MailMessage { $user = $notifiable->profile->first_name; $message = (new MailMessage()) ->greeting( __("Hi :user!", [ "user" => $user, ]), ) ->line("Lista wniosków oczekujących na Twoją akcję - stan na dzień {$this->day->toDisplayString()}:") ->subject("Wnioski oczekujące na akcje - stan na dzień {$this->day->toDisplayString()}"); foreach ($this->vacationRequests as $request) { $message->line( "Wniosek nr {$request->name} użytkownika {$request->user->profile->full_name} ({$request->from->toDisplayString()} - {$request->to->toDisplayString()})", ); } return $message ->action("Przejdź do wniosków", $url); } }