ProjectCreateRequest.php
1.86 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
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Http\Container\AdminSection\Requests\Audition;
use App\Models\Project;
use Hikoon\LaravelApi\Support\ApiRequest;
class ProjectCreateRequest extends ApiRequest
{
/**
* @return void
*/
public function prepareForValidation(): void
{
$this->merge(['is_demo_audit' => 0]);
}
/**
* @return string[]
*/
public function rules(): array
{
return [
'cover' => 'required|string|url',
'name' => 'required|string|unique:' . Project::class . ',name,NULL,id,status,1,deleted_at,NULL',
'intro' => 'nullable|sometimes',
'is_public' => 'required|in:0,1',
'is_can_apply' => 'required|in:0,1',
'is_can_manage' => 'required|in:0,1',
'is_can_demo_apply' => 'required|in:0,1',
'is_demo_audit' => 'required|in:0,1',
'master_id' => 'sometimes|numeric'
];
}
/**
* @return string[]
*/
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' => '主理人类型错误',
'is_demo_audit' => '请选择Demo上架是否需要审核',
];
}
}