123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- /**
- *
- * @file:AddChannelRequest.php
- * @Date: 2023/6/8
- * @Time: 14:50
- */
- namespace Modules\Operation\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- use Modules\Operation\Service\ChannelServic;
- class AddChannelRequest extends FormRequest
- {
- public function rules(): array
- {
- return [
- 'status' => 'required|in:0,1',
- 'type' => [
- 'required',
- 'Integer',
- "gt:0",
- function ($attribute, $value, $fail) {
- $types = array_column(ChannelServic::getNavPagesType(),'value');
- if (!in_array($value,$types)) {
- $fail("频道类型不正确");
- }
- },
- ],
- 'miniprogram_type' => [
- 'required',
- 'Integer',
- "gt:0",
- function ($attribute, $value, $fail) {
- $types = array_column(ChannelServic::getNavPagesType(),'value');
- if (!in_array($value,$types)) {
- $fail("小程序类型不正确");
- }
- },
- ],
- ];
- }
- /**
- * messages
- *
- * @return string[]
- */
- public function messages(): array
- {
- return [
- 'type' => '频道类型不正确',
- 'miniprogram_type' => '小程序类型不正确',
- 'status' => '状态值不正确',
- ];
- }
- }
|