| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- class StoreSparePartOrderRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- */
- public function authorize(): bool
- {
- return hasRole('admin,manager');
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
- */
- public function rules(): array
- {
- return [
- 'spare_part_id' => 'required|exists:spare_parts,id',
- 'source_text' => 'nullable|string|max:255',
- 'sourceable_id' => 'nullable|integer',
- 'sourceable_type' => 'nullable|string',
- 'status' => 'required|in:ordered,in_stock,shipped',
- 'ordered_quantity' => 'required|integer|min:1',
- 'with_documents' => 'boolean',
- 'note' => 'nullable|string',
- ];
- }
- }
|