StoreOrderRequest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Http\Requests\Order;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class StoreOrderRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. */
  9. public function authorize(): bool
  10. {
  11. return auth()->check();
  12. }
  13. /**
  14. * Get the validation rules that apply to the request.
  15. *
  16. * @return array
  17. */
  18. public function rules(): array
  19. {
  20. return [
  21. 'id' => 'nullable|exists:orders,id',
  22. 'user_id' => 'required|exists:users,id',
  23. 'district_id' => 'required|exists:districts,id',
  24. 'area_id' => 'required|exists:areas,id',
  25. 'object_address' => 'required|string|min:5',
  26. 'object_type_id' => 'required|exists:object_types,id',
  27. 'contract_date' => 'nullable|date',
  28. 'contract_number' => 'nullable|string',
  29. 'comment' => 'nullable|string',
  30. 'installation_date' => 'nullable|date',
  31. 'brigadier_id' => 'nullable|exists:brigadiers,id',
  32. 'order_status_id' => 'required|exists:order_statuses,id',
  33. 'tg_group_name' => 'nullable|string',
  34. 'tg_group_link' => 'nullable|string',
  35. 'products' => 'nullable|array',
  36. 'quantity' => 'nullable|array',
  37. ];
  38. }
  39. }