From 6540a4970ffedfd207a63c2b5fc3fc21ac1bf69f Mon Sep 17 00:00:00 2001 From: objecttothis Date: Thu, 29 May 2025 17:01:45 +0400 Subject: [PATCH] Custom Events for plugin triggers - Add custom events for item changes, sales, returns, and inventory. - Add custom events for item and customer csv imports. Signed-off-by: objecttothis --- app/Config/Events.php | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/app/Config/Events.php b/app/Config/Events.php index 0516b4a57..14b7c4074 100644 --- a/app/Config/Events.php +++ b/app/Config/Events.php @@ -65,3 +65,51 @@ Events::on('DBQuery', [$db_log, 'db_log_queries']); $method = new Method(); Events::on('pre_controller', [$method, 'validate_method']); + +/** + * This event triggered when an item sale occurs. + * Plugin functionality is triggered here. + */ +Events::on('item_sale', static function (): void { + // Call plugin controller methods to handle the item sale data sent in the static function. +}); + +/** + * This event triggered when an item return occurs. + * Plugin functionality is triggered here. + */ +Events::on('item_return', static function (): void { + // Call plugin controller methods to handle the item return data sent in the static function. +}); + +/** + * This event triggered when an item is changed. This can be an item create, update or delete. + * Plugin functionality is triggered here. + */ +Events::on('item_change', static function (): void { + // Call plugin controller methods to handle the item change data sent in the static function. +}); + +/** + * This event triggered when an item inventory action occurs. + * This can be during a receiving action or the update inventory partial view in items. + */ +Events::on('item_inventory', static function (): void { + // Call plugin controller methods to handle the item inventory data sent in the static function. +}); + +/** + * This event triggered when an items CSV import occurs. + * Plugin functionality is triggered here. + */ +Events::on('items_csv_import', static function (): void { + // Call plugin controller methods to handle the items CSV import data sent in the static function. +}); + +/** + * This event triggered when a customers CSV import occurs. + * Plugin functionality is triggered here. + */ +Events::on('customers_csv_import', static function (): void { + // Call plugin controller methods to handle the customers CSV import data sent in the static function. +});