23 lines
550 B
PHP
23 lines
550 B
PHP
<?php
|
|
|
|
namespace App\Domains\Purchase\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdatePurchaseItemRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'quantity' => ['sometimes', 'required_without:variant_id', 'integer', 'min:1', 'max:100'],
|
|
'variant_id' => ['sometimes', 'required_without:quantity', 'integer', 'min:1'],
|
|
];
|
|
}
|
|
}
|