| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Http\Requests;
- use App\Models\Role;
- use Illuminate\Foundation\Http\FormRequest;
- class StoreReclamationSparePartsRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- */
- public function authorize(): bool
- {
- return in_array(auth()->user()?->role, [Role::ADMIN, Role::MANAGER]);
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array
- */
- public function rules(): array
- {
- return [
- 'rows' => 'nullable|array',
- 'rows.*.spare_part_id' => 'nullable|integer|exists:spare_parts,id',
- 'rows.*.quantity' => 'nullable|integer|min:0',
- 'rows.*.with_documents' => 'nullable',
- ];
- }
- }
|