hook_action 统一命名

This commit is contained in:
Edward Yang 2023-02-07 11:19:17 +08:00
parent 393b25f34e
commit 6095b5de23
5 changed files with 14 additions and 6 deletions

View File

@ -102,8 +102,12 @@ class PluginController extends Controller
}
}
$data = ['plugin_code' => $code, 'fields' => $fields];
hook_action('plugin.update.before', $data);
SettingRepo::update('plugin', $code, $fields);
hook_action('after_edit_plugin', ['plugin_code' => $code, 'fields' => $fields]);
hook_action('plugin.update.after', $data);
return redirect($this->getRedirect())->with('success', trans('common.updated_success'));
}

View File

@ -22,7 +22,7 @@ class CurrencyController extends Controller
Session::put('currency', $currency);
}
hook_action('currency.index', $currency);
hook_action('currency.index.after', $currency);
return Redirect::back();
}

View File

@ -22,7 +22,7 @@ class LanguageController extends Controller
Session::put('locale', $lang);
}
hook_action('language.index', $lang);
hook_action('language.index.after', $lang);
return Redirect::back();
}

View File

@ -37,10 +37,12 @@ class AccountService
}
$data['avatar'] = $data['avatar'] ?? '';
hook_action('service.account.register.before', $data);
$customer = CustomerRepo::create($data);
if ($customer) {
$customer->notifyRegistration();
hook_action('after_register', $customer);
hook_action('service.account.register.after', $customer);
}
return $customer;

View File

@ -73,6 +73,8 @@ class CheckoutService
$guestShippingAddress = $requestData['guest_shipping_address'] ?? [];
$guestPaymentAddress = $requestData['guest_payment_address'] ?? [];
hook_action('service.checkout.update.before', ['request_data' => $requestData, 'cart' => $this->cart]);
if ($shippingAddressId) {
$this->updateShippingAddressId($shippingAddressId);
}
@ -93,7 +95,7 @@ class CheckoutService
$this->updateGuestPaymentAddress($guestPaymentAddress);
}
hook_action('after_checkout_update', ['request_data' => $requestData, 'cart' => $this->cart]);
hook_action('service.checkout.update.after', ['request_data' => $requestData, 'cart' => $this->cart]);
return $this->checkoutData();
}
@ -181,7 +183,7 @@ class CheckoutService
throw new \Exception(trans('shop/carts.invalid_payment_method'));
}
hook_action('after_checkout_validate', $checkoutData);
hook_action('service.checkout.validate_confirm.after', $checkoutData);
}
private function updateShippingAddressId($shippingAddressId)