[Fixed: changed customer group code for newly created customer.]
This commit is contained in:
parent
217412a563
commit
2ff9ebfa17
|
|
@ -4,11 +4,13 @@ namespace Webkul\API\Http\Controllers\Shop;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Webkul\Customer\Repositories\CustomerRepository;
|
use Webkul\Customer\Repositories\CustomerRepository;
|
||||||
|
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer controller
|
* Customer controller
|
||||||
*
|
*
|
||||||
* @author Jitendra Singh <jitendra@webkul.com>
|
* @author Jitendra Singh <jitendra@webkul.com>
|
||||||
|
* @author Vivek Sharma <viveksh047@webkul.com> @vivek-webkul
|
||||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||||
*/
|
*/
|
||||||
class CustomerController extends Controller
|
class CustomerController extends Controller
|
||||||
|
|
@ -28,13 +30,28 @@ class CustomerController extends Controller
|
||||||
protected $customerRepository;
|
protected $customerRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CustomerRepository object $customer
|
* Repository object
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
public function __construct(CustomerRepository $customerRepository)
|
protected $customerGroupRepository;
|
||||||
{
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||||
|
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
CustomerRepository $customerRepository,
|
||||||
|
CustomerGroupRepository $customerGroupRepository
|
||||||
|
) {
|
||||||
$this->_config = request('_config');
|
$this->_config = request('_config');
|
||||||
|
|
||||||
$this->customerRepository = $customerRepository;
|
$this->customerRepository = $customerRepository;
|
||||||
|
|
||||||
|
$this->customerGroupRepository = $customerGroupRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,10 +73,11 @@ class CustomerController extends Controller
|
||||||
$data = array_merge($data, [
|
$data = array_merge($data, [
|
||||||
'password' => bcrypt($data['password']),
|
'password' => bcrypt($data['password']),
|
||||||
'channel_id' => core()->getCurrentChannel()->id,
|
'channel_id' => core()->getCurrentChannel()->id,
|
||||||
'is_verified' => 1,
|
'is_verified' => 1
|
||||||
'customer_group_id' => 1
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$data['customer_group_id'] = $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id;
|
||||||
|
|
||||||
Event::dispatch('customer.registration.before');
|
Event::dispatch('customer.registration.before');
|
||||||
|
|
||||||
$customer = $this->customerRepository->create($data);
|
$customer = $this->customerRepository->create($data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue