OrderRequest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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', 'required', 'integer'],
  24. 'couponId' => ['bail', 'integer'],
  25. 'orderId' => ['bail', 'string'],
  26. 'payType' => ['bail', 'required', 'string'],
  27. 'addressId' => ['bail', 'required', 'integer'],
  28. ];
  29. $actionName = last(explode('@', Route::current()->getActionName()));
  30. if ($actionName === 'index') {
  31. }
  32. if($actionName === 'show'){
  33. }
  34. if ($actionName === 'apply') {
  35. }
  36. return $rules;
  37. }
  38. public function messages(): array
  39. {
  40. return [
  41. '*' => '参数或类型错误!'
  42. ];
  43. }
  44. }