'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' => '状态值不正确', ]; } }