test for date end being before date start
This commit is contained in:
parent
a752ff9ba5
commit
858f2e075f
2 changed files with 21 additions and 0 deletions
|
|
@ -50,6 +50,13 @@ class CreatePlan
|
|||
throw new BadRequestException('date end is required');
|
||||
}
|
||||
|
||||
$startDate = new DateTimeImmutable($request->dateStart);
|
||||
$endDate = new DateTimeImmutable($request->dateEnd);
|
||||
|
||||
if ($endDate < $startDate) {
|
||||
throw new BadRequestException('date end cannot be before date start');
|
||||
}
|
||||
|
||||
$userId = $request->userId;
|
||||
$user = $this->userRepo->find($userId);
|
||||
if ($user === null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue