F
Filamentβ€’15mo ago
sadiqgoni13

Decrease Inventory Asset Quantity

Please i have an asset resource that i can add product with quantity and i have an inventoryRequest resource that i can retrieve the product added from asset with quantity, I want the quantity to reduce or decrease whenever i retrieve in inventoryRequest
Solution:
in your inventoryRequest you can use a hook ```...
Jump to solution
4 Replies
Solution
Lara Zeus
Lara Zeusβ€’15mo ago
in your inventoryRequest you can use a hook
protected function afterCreate(): void
{
// Runs after the form fields are saved to the database.
dd($this-record);
}
protected function afterCreate(): void
{
// Runs after the form fields are saved to the database.
dd($this-record);
}
Lara Zeus
Lara Zeusβ€’14mo ago
since the delete is an action, so you can do before and after it's in the actions docs too πŸ™‚ will, this is a business decision πŸ™‚ so it depends on the business . but I would decrease the quantity as you said
sadiqgoni13
sadiqgoni13OPβ€’14mo ago
This is great Thankyou All
Want results from more Discord servers?
Add your server