UpdateScheduleRequest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class UpdateScheduleRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. */
  9. public function authorize(): bool
  10. {
  11. return hasRole('admin');
  12. }
  13. /**
  14. * Get the validation rules that apply to the request.
  15. *
  16. * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
  17. */
  18. public function rules(): array
  19. {
  20. return [
  21. 'id' => 'nullable|exists:schedules,id',
  22. 'installation_date' => 'required|date',
  23. 'comment' => 'nullable|string',
  24. 'area_id' => 'nullable|exists:areas,id',
  25. 'district_id' => 'nullable|exists:districts,id',
  26. 'brigadier_id' => 'required|exists:users,id',
  27. 'object_address' => 'required|string',
  28. 'object_type' => 'required|string',
  29. 'mafs' => 'required|string',
  30. 'mafs_count' => 'required|integer',
  31. 'address_code' => 'nullable|string',
  32. ];
  33. }
  34. }