1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace Modules\Manage\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rule;
- use Modules\Manage\Enmus\MiniprogramType;
- class MiniprogramUpdateRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- */
- public function authorize(): bool
- {
- return true;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
- */
- public function rules(): array
- {
- return [
- 'name'=> 'required|max:50',
- 'play_name'=> 'required|max:100',
- 'company'=> 'required|max:255',
- 'type'=> [
- 'required',
- Rule::in( array_map( fn($item)=>$item->value(),MiniprogramType::cases())),
- ],
- 'appsecret'=>'required|min:30|max:64',
- 'appid'=>'required|min:18|max:32',
- 'status'=>'in:0,1'
- ];
- }
- public function messages(): array
- {
- return [
- 'name.required'=>'小程序名称必填',
- 'appid.min'=>'appid太短',
- 'appid.max'=>'appid过长',
- 'appsecret.min'=>'appsecret太短',
- 'appsecret.max'=>'appsecret过长'
- ];
- }
- }
|