OrderRequest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @Name
  4. * @Description
  5. * @Author 刘学玺
  6. * @Date 2024/3/20 14:54
  7. */
  8. namespace App\Http\Requests\Frontend\Client\Service;
  9. use App\Http\Requests\Request;
  10. use Illuminate\Support\Facades\Route;
  11. use Illuminate\Validation\Rule;
  12. class OrderRequest extends Request
  13. {
  14. /**
  15. * Get the validation rules that apply to the request.
  16. *
  17. * @return array<string, array|string>
  18. */
  19. public function rules(): array
  20. {
  21. $rules = [
  22. 'coachId' => ['bail', 'integer'],
  23. 'projectId' => ['bail', 'integer'],
  24. 'couponId' => ['bail', 'integer'],
  25. 'orderId' => ['bail', 'integer'],
  26. 'payType' => ['bail', 'integer'],
  27. 'useBalance' => ['bail', 'integer'],
  28. 'remark' => ['bail', 'string'],
  29. 'addressId' => ['bail', 'integer'],
  30. 'carType' => ['bail', 'integer']
  31. ];
  32. $actionName = last(explode('@', Route::current()->getActionName()));
  33. if ($actionName === 'store') {
  34. }
  35. if ($actionName === 'index') {
  36. }
  37. if ($actionName === 'show') {
  38. }
  39. if ($actionName === 'apply') {
  40. }
  41. return $rules;
  42. }
  43. public function messages(): array
  44. {
  45. return [
  46. '*' => '参数或类型错误!'
  47. ];
  48. }
  49. }