#20 - wip
This commit is contained in:
28
app/Helpers/VacationRequestValidator.php
Normal file
28
app/Helpers/VacationRequestValidator.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Helpers;
|
||||
|
||||
use Illuminate\Contracts\Pipeline\Pipeline;
|
||||
use Toby\Models\VacationRequest;
|
||||
|
||||
class VacationRequestValidator
|
||||
{
|
||||
protected array $rules = [
|
||||
|
||||
];
|
||||
|
||||
public function __construct(protected Pipeline $pipeline)
|
||||
{
|
||||
}
|
||||
|
||||
public function validate(VacationRequest $vacationRequest): void
|
||||
{
|
||||
$this->pipeline
|
||||
->send($vacationRequest)
|
||||
->through($this->rules)
|
||||
->via("check")
|
||||
->then(fn(VacationRequest $vacationRequest) => $vacationRequest);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user