toby/app/Domain/Validation/Rules/VacationRangeIsInTheSameYearRule.php
Adrian Hopek 51d3849b58 #36 - wip
2022-02-07 10:36:01 +01:00

21 lines
484 B
PHP

<?php
declare(strict_types=1);
namespace Toby\Domain\Validation\Rules;
use Toby\Eloquent\Models\VacationRequest;
class VacationRangeIsInTheSameYearRule implements VacationRequestRule
{
public function check(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.");
}
}