ActivityManagerCreateRequest.php 1.02 KB
<?php

namespace App\Http\Container\AdminSection\Requests\Audition;

use Hikoon\LaravelApi\Support\ApiRequest;

class ActivityManagerCreateRequest extends ApiRequest
{
    protected function prepareForValidation(): void
    {
        $this->merge([
            'expand->permission' => $this->input('permission', []),
        ]);
    }

    public function rules(): array
    {
        return [
            'activity_id'        => 'required|numeric',
            'user_ids'           => 'required|array',
            'user_ids.*'         => 'required|numeric',
            'expand->permission' => 'required|array'
        ];
    }

    public function messages(): array
    {
        return [
            'activity_id.required'        => '请选择活动',
            'activity_id.numeric'         => '活动类型错误',
            'user_ids.required'           => '请选择用户',
            'user_ids.*.numeric'          => '用户类型错误',
            'expand->permission.required' => '请选择权限类型'
        ];
    }
}