1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- /**
- * @Name
- * @Description
- * @Author 刘学玺
- * @Date 2024/3/20 14:54
- */
- namespace App\Http\Requests\Frontend\Client\Service;
- use App\Http\Requests\Request;
- use Illuminate\Support\Facades\Route;
- use Illuminate\Validation\Rule;
- class OrderRequest extends Request
- {
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, array|string>
- */
- public function rules(): array
- {
- $rules = [
- 'coachId' => ['bail', 'integer'],
- 'projectId' => ['bail', 'required', 'integer'],
- 'couponId' => ['bail', 'integer'],
- 'orderId' => ['bail', 'string'],
- 'payType' => ['bail', 'required', 'string'],
- 'addressId' => ['bail', 'required', 'integer'],
- ];
- $actionName = last(explode('@', Route::current()->getActionName()));
- if ($actionName === 'index') {
- }
- if($actionName === 'show'){
- }
- if ($actionName === 'apply') {
- }
- return $rules;
- }
- public function messages(): array
- {
- return [
- '*' => '参数或类型错误!'
- ];
- }
- }
|