本文整理汇总了PHP中app\Customer::customer_addresses方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::customer_addresses方法的具体用法?PHP Customer::customer_addresses怎么用?PHP Customer::customer_addresses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::customer_addresses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register($data)
{
Customer::where('email', $data['email'])->where('email_confirmed', false)->delete();
$customer = new Customer(['email' => $data['email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'password' => $data['password'], 'gender_id' => $data['gender_id']]);
$customer->save();
$invoice = ['email' => $data['email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'gender_id' => $data['gender_id'], 'country_id' => config('shop.default_country_id')];
$shipping = $invoice;
$invoice['address_kind_id'] = config('shop.invoice_address_kind_id');
$shipping['address_kind_id'] = config('shop.shipping_address_kind_id');
$invoice_address = new CustomerAddress($invoice);
$shipping_address = new CustomerAddress($shipping);
$customer->customer_addresses()->saveMany([$invoice_address, $shipping_address]);
return $customer;
}