| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | <?phpnamespace App\Http\Requests\Index;use App\Http\Requests\Request;use Illuminate\Database\Query\Builder;use Illuminate\Validation\Rule;class ProfilerRequest extends Request{    /**     * Determine if the user is authorized to make this request.     *     * @return bool     */    public function authorize()    {        return true;    }    /**     * Get the validation rules that apply to the request.     *     * @return array     */    public function rules()    {        if (!$this->ajax()) {            return [];        }        return [            'profile_img' => 'nullable',            'nickname' => 'nullable',            'username' => [                'required',                'min:3',                'max:15',                Rule::unique('users')->where(function (Builder $query) {                    return $query->where('deleted_at', null);                })->ignore($this->input('id'))            ],            'phone' => [                'required',                Rule::unique('users')->where(function (Builder $query) {                    return $query->where('deleted_at', null);                })->ignore($this->input('id'))            ],            'password' => 'nullable|min:5|max:15',            'entry_time'=>'nullable',            'email' => 'email',            'qq'=>'nullable',            'telephone'=>'nullable',            'intro'=>'nullable',        ];    }    public function attributes()    {        return [            'nickname' => '昵称',            'profile_img' => '头像',            'username' => '用户名',            'phone' => '手机号',            'password' => '密码',            'email' => '邮箱',            'qq'=>'qq号',            'telephone'=>'座机'        ];    }}
 |