| 1 |
<?php |
| 2 |
|
| 3 |
namespace App\Billingo\Validation\Document; |
| 4 |
|
| 5 |
use App\Billingo\Enums\PaymentMethodEnum; |
| 6 |
use App\Billingo\Models\Document\DocumentItem; |
| 7 |
use App\Billingo\Models\Document\DocumentItemData; |
| 8 |
use App\Billingo\Models\Document\DocumentProductData; |
| 9 |
use App\Billingo\Models\Document\ReceiptItemData; |
| 10 |
use App\Billingo\Validation\Validator; |
| 11 |
|
| 12 |
class ModificationDocumentInsertValidator extends Validator |
| 13 |
{ |
| 14 |
|
| 15 |
protected function rules(): array |
| 16 |
{ |
| 17 |
return [ |
| 18 |
'due_date' => ['optional', ['regex', '/^\d{4}-\d{2}-\d{2}$/']], |
| 19 |
'comment' => ['optional', 'string'], |
| 20 |
'payment_method' => ['optional', ['in', getEnumValues(PaymentMethodEnum::class)]], |
| 21 |
'without_financial_fulfillment' => ['optional', 'boolean'], |
| 22 |
'items' => ['optional', 'array'], |
| 23 |
'items.*' => ['optional', ['instanceOfAny', [DocumentItemData::class, DocumentProductData::class]]] |
| 24 |
]; |
| 25 |
} |
| 26 |
} |
| 27 |
|