Commit 93b04f4e by 杨树贤

地址页面

parent ec46896a
......@@ -2,6 +2,8 @@
namespace App\Http\Requests;
use App\Models\UserAddressModel;
use App\Models\UserModel;
use Illuminate\Foundation\Http\FormRequest;
class UserAddressSave extends BaseRequest
......@@ -32,7 +34,13 @@ class UserAddressSave extends BaseRequest
'company_name' => 'required|max:50',
'detail_address' => 'required|max:255',
'post_code' => 'required|max:10',
'address_type' => 'required|in:1,2'
];
if (request()->input('address_type') == UserAddressModel::ADDRESS_TYPE_COMPANY) {
$rules['company_name'] = 'required|max:50';
}
$isRegister = request()->input('is_register');
if (!$isRegister) {
$rules['email'] = 'required|email';
......
......@@ -33,7 +33,8 @@ class UserRegister extends BaseRequest
'phone' => 'required|max:100',
'account_properties' => 'required|in:1,2'
];
if (request()->input('account_properties') == 2) {
if (request()->input('account_properties') == UserModel::ACCOUNT_PROPERTIES_COMPANY) {
$rule['company_name'] = 'required|max:50';
}
return $rule;
......
......@@ -14,6 +14,9 @@ class UserAddressModel extends Model
protected $fillable = [
];
const ADDRESS_TYPE_PERSONAL = 1;
const ADDRESS_TYPE_COMPANY = 2;
public function user()
{
return $this->belongsTo(UserModel::class);
......
......@@ -42,6 +42,11 @@ class UserModel extends Authenticatable implements MustVerifyEmail
'email_verified_at' => 'datetime',
];
const ACCOUNT_PROPERTIES_PERSONAL = 1;
const ACCOUNT_PROPERTIES_COMPANY = 2;
//获取用户详情
public static function getUserInfo($user_id)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment