#126 - vacation request reminders (#130)

* #126 - vacation request reminders

* #126 - fix workdays

* #126 - changes

* #126 - cs fix

* #5 - bump codestyle

* #126 - fix

* #126 - fix

* #126 - fix

* #126 - fix

* #126 - tests

* #126 - fix

* #126 - fix

* #126 - fix seeders

* #126 - fix

* #126 - tests

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-04-27 15:26:55 +02:00
committed by GitHub
parent c69866bb52
commit 6b2556c1da
22 changed files with 407 additions and 69 deletions

View File

@@ -9,6 +9,7 @@ use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use InvalidArgumentException;
use Toby\Eloquent\Models\VacationRequest;
use Toby\Infrastructure\Slack\Elements\SlackMessage;
class VacationRequestCreatedNotification extends Notification
{
@@ -23,14 +24,12 @@ class VacationRequestCreatedNotification extends Notification
return [Channels::MAIL, Channels::SLACK];
}
public function toSlack(): string
public function toSlack(): SlackMessage
{
$url = route("vacation.requests.show", ["vacationRequest" => $this->vacationRequest->id]);
return implode("\n", [
$this->buildDescription(),
"<${url}|Zobacz szczegóły>",
]);
return (new SlackMessage())
->text("{$this->buildDescription()}\n <${url}|Zobacz szczegóły>");
}
/**
@@ -56,19 +55,25 @@ class VacationRequestCreatedNotification extends Notification
$days = $this->vacationRequest->vacations()->count();
return (new MailMessage())
->greeting(__("Hi :user!", [
"user" => $user,
]))
->greeting(
__("Hi :user!", [
"user" => $user,
]),
)
->subject($this->buildSubject())
->line($this->buildDescription())
->line(__("Vacation type: :type", [
"type" => $type,
]))
->line(__("From :from to :to (number of days: :days)", [
"from" => $from,
"to" => $to,
"days" => $days,
]))
->line(
__("Vacation type: :type", [
"type" => $type,
]),
)
->line(
__("From :from to :to (number of days: :days)", [
"from" => $from,
"to" => $to,
"days" => $days,
]),
)
->action(__("Click here for details"), $url);
}