ProjectUpdateRequest.php
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace App\Http\Container\AdminSection\Requests\Audition;
use App\Models\Project;
use Hikoon\LaravelApi\Support\ApiRequest;
class ProjectUpdateRequest extends ApiRequest
{
protected function prepareForValidation(): void
{
$this->merge(['master_id' => $this->integer('master_id')]);
}
public function rules(): array
{
return [
'cover' => 'bail|required|string|url',
'name' => 'bail|required|string|unique:' . Project::class . ',name,' . $this->route('project.id') . ',id,status,1,deleted_at,NULL',
'intro' => 'bail|nullable|sometimes',
'is_promote' => 'bail|required|in:0,1',
'is_public' => 'bail|required|in:0,1',
'is_can_apply' => 'required|in:0,1',
'is_can_demo_apply' => 'required|in:0,1',
'is_can_manage' => 'required|in:0,1',
'master_id' => 'sometimes|numeric'
];
}
public function messages(): array
{
return [
'cover.required' => "请上传厂牌图片",
'cover.url' => "厂牌图片格式错误",
'name.required' => '请输入厂牌名称',
'name.unique' => '厂牌名称已存在',
'is_promote.*' => '请选择是否确认分享人',
'is_public.*' => '请选择是否仅显示自己创建的试唱歌曲',
'is_can_apply.*' => '请选择是否允许提交歌曲上架',
'is_can_demo_apply' => '请选择是否允许提交Demo上架',
'is_can_manage.*' => '请选择是否允许自行添加外部成员',
'master_id.numeric' => '主理人类型错误'
];
}
}