Skip to content

Commit

Permalink
限制头像分辨率
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Sep 19, 2019
1 parent 5bd1c41 commit 49ac90b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Http/Requests/UserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ public function rules()
'name' => 'required|between:3,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:users,name,' . Auth::id(),
'email' => 'required|email',
'introduction' => 'max:80',
'avatar' => 'mimes:jpeg,bmp,png,gif|dimensions:min_width=208,min_height=208',
];
}

public function messages()
{
return [
'avatar.mimes' =>'头像必须是 jpeg, bmp, png, gif 格式的图片',
'avatar.dimensions' => '图片的清晰度不够,宽和高需要 208px 以上',
'name.unique' => '用户名已被占用,请重新填写',
'name.regex' => '用户名只支持英文、数字、横杠和下划线。',
'name.between' => '用户名必须介于 3 - 25 个字符之间。',
Expand Down

0 comments on commit 49ac90b

Please sign in to comment.