You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
1.0 KiB

<?php
declare(strict_types=1);
namespace App\Request\v3;
use App\Model\v3\User;
use App\Request\BaseFormRequest;
use Hyperf\Utils\ApplicationContext;
class CommunityBindRequest extends BaseFormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$userTable = ApplicationContext::getContainer()->get(User::class)->getTable();
return [
'source_id' => 'required|nonempty',
'user_id' => 'required|nonempty|exists_enable:'.$userTable.',id',
'json_data' => 'json',
];
}
public function messages(): array
{
return [
'*.nonempty' => ':attribute参数异常',
'user_id.exists_enable' => '用户不存在',
];
}
public function attributes(): array
{
return [
];
}
}