StoreOrderRequest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. 'name' => 'required|string',
  23. 'user_id' => 'required|exists:users,id',
  24. 'district_id' => 'required|exists:districts,id',
  25. 'area_id' => 'required|exists:areas,id',
  26. 'object_address' => 'required|string|min:5',
  27. 'object_type_id' => 'required|exists:object_types,id',
  28. 'comment' => 'nullable|string',
  29. 'installation_date' => 'nullable|date',
  30. 'ready_date' => 'nullable|date',
  31. 'brigadier_id' => 'nullable|exists:users,id',
  32. 'tg_group_name' => 'nullable|string',
  33. 'tg_group_link' => 'nullable|string',
  34. 'products' => 'nullable|array',
  35. 'quantity' => 'nullable|array',
  36. 'products_sku' => 'nullable|array',
  37. 'order_status_id' => 'nullable|exists:order_statuses,id',
  38. 'install_days' => 'nullable|integer|min:1',
  39. ];
  40. }
  41. }