# Packages
This works just like any Laravel package, read their documentation to get started (opens new window) and have a look at the existing packages to see how things are handled.
# Eventy Filters
Eventy (opens new window) is used to have Wordpress style filters which can be used within packages. Have a look at their docs (opens new window) to see how these filters can be used or at the AmastyLabelServiceProvider.php
(opens new window) from the Rapidez Amasty Label (opens new window) package as an example.
Filter | Explanation |
---|---|
*.scopes | Add additional global scopes to every model available e.g. product.scopes or category.scopes |
product.casts | Add additional global product casts |
product.children.select | Manipulate the children select query |
product.grouped.select | Manipulate the grouped products select query |
productpage.scopes | Add product scopes only for the product page |
productpage.frontend.attributes | Add product attributes to the frontend |
quote.items.select | Manipulate the quote items select query |
index.product.scopes | Add product scopes to the product query when indexing |
index.product.data | Manipulate the product data before it's getting indexed |
index.product.attributes | Index additional product attributes |
index.product.mapping | Manipulate the index mapping |
routes | Register additional fallback routes (example (opens new window)) |
Every models extends the base model (opens new window) which uses the HasEventyGlobalScopeFilter
trait (opens new window) so it's possible to add scopes to every model, for example the category model: category.scopes
# Vue Events
Rapidez emits some custom Vue events you can hook into with $on
(opens new window). This is used for example within the Rapidez Mollie (opens new window) package, have a look at the mollie.js
(opens new window) file.
Event | Explanation |
---|---|
cart-refreshed | After the cart is refreshed |
checkout-credentials-saved | After the checkout credentials are saved |
checkout-payment-saved | After the payment method is saved |
product-super-attribute-change | After a swatch change, when calling this the product image updates based on the choice. |
logged-in | After the user has logged in. |
logout | After the user attempts to log out, listen to this to clear any sensitive information about the user. |
There is also a doNotGoToTheNextStep
variable on the root Vue instance which can be used to prevent the checkout from going to the next step. That's also used within the Rapidez Mollie (opens new window) package to prevent the checkout from going to the success page because you've to pay first and we'd like to redirect the user to the payment page.