123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Http\Requests\Coach;
- use Illuminate\Foundation\Http\FormRequest;
- /**
- * 技师开通项目请求验证
- */
- class OpenProjectRequest extends FormRequest
- {
- /**
- * 判断用户是否有权限进行此请求
- */
- public function authorize(): bool
- {
- return true;
- }
- /**
- * 获取验证规则
- *
- * @return array<string, mixed> 验证规则数组
- */
- public function rules(): array
- {
- return [
- 'project_id' => 'required|integer|exists:project,id',
- ];
- }
- /**
- * 获取验证错误消息
- *
- * @return array<string, string> 错误消息数组
- */
- public function messages(): array
- {
- return [
- 'project_id.required' => '项目ID不能为空',
- 'project_id.integer' => '项目ID必须是整数',
- 'project_id.exists' => '项目不存在',
- ];
- }
- }
|