diff --git a/beike/Admin/Http/Requests/CustomerRequest.php b/beike/Admin/Http/Requests/CustomerRequest.php index 684e0109..8b561384 100644 --- a/beike/Admin/Http/Requests/CustomerRequest.php +++ b/beike/Admin/Http/Requests/CustomerRequest.php @@ -32,12 +32,15 @@ class CustomerRequest extends FormRequest */ public function rules() { - return [ + $rules = [ 'name' => 'required|max:64', 'email' => 'required|email:rfc,dns|unique:customers', - 'password' => 'required|max:64', 'customer_group_id' => 'required|exists:customer_groups,id', ]; + if (!$this->request->get('id')) { + $rules['password'] = 'required|max:64'; + } + return $rules; } public function attributes() diff --git a/beike/Admin/Services/CustomerService.php b/beike/Admin/Services/CustomerService.php index b618e88f..a3639493 100644 --- a/beike/Admin/Services/CustomerService.php +++ b/beike/Admin/Services/CustomerService.php @@ -20,7 +20,7 @@ class CustomerService { public static function create($data) { - $data['locale'] = setting('locale'); + $data['locale'] = setting('system.locale'); $data['from'] = 'admin'; $customer = CustomerRepo::create($data); return $customer;