Add hook from mundosanjose
This commit is contained in:
parent
3266cb4924
commit
76edc24c77
|
|
@ -35,20 +35,30 @@ class LoginController extends Controller
|
|||
|
||||
public function store(LoginRequest $request)
|
||||
{
|
||||
$guestCartProduct = CartRepo::allCartProducts(0);
|
||||
if (! auth(Customer::AUTH_GUARD)->attempt($request->only('email', 'password'))) {
|
||||
throw new NotAcceptableHttpException(trans('shop/login.email_or_password_error'));
|
||||
$data = [
|
||||
'request_data' => $request->all(),
|
||||
];
|
||||
|
||||
try {
|
||||
hook_action('shop.account.login.before', $data);
|
||||
|
||||
$guestCartProduct = CartRepo::allCartProducts(0);
|
||||
if (! auth(Customer::AUTH_GUARD)->attempt($request->only('email', 'password'))) {
|
||||
throw new NotAcceptableHttpException(trans('shop/login.email_or_password_error'));
|
||||
}
|
||||
|
||||
$customer = current_customer();
|
||||
if ($customer && $customer->status != 1) {
|
||||
Auth::guard(Customer::AUTH_GUARD)->logout();
|
||||
|
||||
throw new NotFoundHttpException(trans('shop/login.customer_inactive'));
|
||||
}
|
||||
|
||||
CartRepo::mergeGuestCart($customer, $guestCartProduct);
|
||||
|
||||
return json_success(trans('shop/login.login_successfully'));
|
||||
} catch (\Exception $e) {
|
||||
return json_fail($e->getMessage());
|
||||
}
|
||||
|
||||
$customer = current_customer();
|
||||
if ($customer && $customer->status != 1) {
|
||||
Auth::guard(Customer::AUTH_GUARD)->logout();
|
||||
|
||||
throw new NotFoundHttpException(trans('shop/login.customer_inactive'));
|
||||
}
|
||||
|
||||
CartRepo::mergeGuestCart($customer, $guestCartProduct);
|
||||
|
||||
return json_success(trans('shop/login.login_successfully'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CartDetail extends JsonResource
|
|||
$subTotal = $price * $this->quantity;
|
||||
$image = $sku->image ?: $product->image;
|
||||
|
||||
return [
|
||||
$result = [
|
||||
'cart_id' => $this->id,
|
||||
'product_id' => $this->product_id,
|
||||
'sku_id' => $this->product_sku_id,
|
||||
|
|
@ -44,5 +44,7 @@ class CartDetail extends JsonResource
|
|||
'subtotal_format' => currency_format($subTotal),
|
||||
'variant_labels' => trim($sku->getVariantLabel()),
|
||||
];
|
||||
|
||||
return hook_filter('resource.cart.detail', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class SkuDetail extends JsonResource
|
|||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
$result = [
|
||||
'id' => $this->id,
|
||||
'variants' => $this->variants ?: [],
|
||||
'position' => $this->position,
|
||||
|
|
@ -37,5 +37,7 @@ class SkuDetail extends JsonResource
|
|||
'quantity' => $this->quantity,
|
||||
'is_default' => $this->is_default,
|
||||
];
|
||||
|
||||
return hook_filter('resource.sku.detail', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,9 +107,11 @@
|
|||
<div>
|
||||
<h5 class="border-bottom pb-3 mb-4">{{ __('admin/product.stocks') }}</h5>
|
||||
|
||||
@hookwrapper('admin.product.edit.switch')
|
||||
<x-admin::form.row :title="__('admin/product.enable_multi_spec')">
|
||||
<el-switch v-model="editing.isVariable" @change="isVariableChange" class="mt-2"></el-switch>
|
||||
</x-admin::form.row>
|
||||
@endhookwrapper
|
||||
|
||||
<input type="hidden" name="variables" :value="JSON.stringify(form.variables)">
|
||||
|
||||
|
|
@ -265,6 +267,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@hookwrapper('admin.product.edit.variable')
|
||||
<template v-if="!editing.isVariable">
|
||||
<input type="hidden" value="{{ old('skus.0.image', $product->skus[0]->image ?? '') }}" name="skus[0][image]">
|
||||
<x-admin-form-input name="skus[0][model]" :title="__('admin/product.model')" :value="old('skus.0.model', $product->skus[0]->model ?? '')" />
|
||||
|
|
@ -277,6 +280,7 @@
|
|||
<input type="hidden" name="skus[0][position]" placeholder="position" value="0">
|
||||
<input type="hidden" name="skus[0][is_default]" placeholder="is_default" value="1">
|
||||
</template>
|
||||
@endhookwrapper
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab-descriptions">
|
||||
|
|
|
|||
Loading…
Reference in New Issue