crm injection de user existant
produits sans type affichage
This commit is contained in:
parent
cd9cf498a0
commit
9878b69f2d
2 changed files with 24 additions and 1 deletions
|
|
@ -144,6 +144,29 @@ class CustomerController extends Controller
|
|||
}
|
||||
}
|
||||
} else {
|
||||
//check if customer exists in CRM to auto create
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$result = $crm->loginCustomer($email, $password);
|
||||
if ($result->status === "OK") {
|
||||
$customer = new Customers($request->all());
|
||||
$customer->crm_id = $result->user->crm_id;
|
||||
$customer->hashcode = $result->user->hashcode;
|
||||
$customer->save();
|
||||
//connect
|
||||
/** @var \Illuminate\Auth\SessionGuard */
|
||||
$guard = Auth::guard('customer');
|
||||
$guard->login($customer, $remember);
|
||||
$url = Session::pull('url.intended');
|
||||
Session::forget('url.intended');
|
||||
Session::save();
|
||||
if (empty($url)) {
|
||||
return redirect()->route('account.dashboard');
|
||||
}
|
||||
return redirect()->to($url);
|
||||
} else {
|
||||
//n'existe pas en CRM
|
||||
}
|
||||
return back()->withErrors("Email ou mot de passe incorrect.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ProductsController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
$product->additionnalProductInfo = $product->additionnalProductInfo($product->product_type);
|
||||
if ($product->additionnalProductInfo === null) {
|
||||
if ($product->additionnalProductInfo === null && !empty($product_type)) {
|
||||
//n'existe pas on renseigne un vide
|
||||
$product_type = $product->product_type;
|
||||
$modelClass = 'App\Models\\' . ucfirst($product_type);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue