toby/app/Domain/Validation/Rules/VacationRangeIsInTheSameYearRule.php
Adrian Hopek eadf984f30 #36 - wip
2022-02-07 08:05:35 +01:00

21 lines
482 B
PHP

<?php
declare(strict_types=1);
namespace Toby\Domain\Validation\Rules;
use Toby\Eloquent\Models\VacationRequest;
class VacationRangeIsInTheSameYearRule extends VacationRequestRule
{
public function passes(VacationRequest $vacationRequest): bool
{
return $vacationRequest->from->isSameYear($vacationRequest->to);
}
public function errorMessage(): string
{
return __("The vacation request cannot be created at the turn of the year.");
}
}