diff --git a/app/Http/Controllers/Components/ComponentCheckoutController.php b/app/Http/Controllers/Components/ComponentCheckoutController.php index 4abf426de3..4214abb434 100644 --- a/app/Http/Controllers/Components/ComponentCheckoutController.php +++ b/app/Http/Controllers/Components/ComponentCheckoutController.php @@ -102,13 +102,15 @@ class ComponentCheckoutController extends Controller return redirect()->route('components.checkout.show', $componentId)->with('error', trans('general.error_user_company')); } + $component->checkout_qty = $request->input('assigned_qty'); + // Update the component data $component->asset_id = $request->input('asset_id'); $component->assets()->attach($component->id, [ 'component_id' => $component->id, 'created_by' => auth()->user()->id, 'created_at' => date('Y-m-d H:i:s'), - 'assigned_qty' => $request->input('assigned_qty'), + 'assigned_qty' => $component->checkout_qty, 'asset_id' => $request->input('asset_id'), 'note' => $request->input('note'), ]); diff --git a/app/Mail/CheckoutComponentMail.php b/app/Mail/CheckoutComponentMail.php index e914d14196..4a866b1410 100644 --- a/app/Mail/CheckoutComponentMail.php +++ b/app/Mail/CheckoutComponentMail.php @@ -26,7 +26,7 @@ class CheckoutComponentMail extends Mailable $this->note = $note; $this->target = $checkedOutTo; $this->acceptance = $acceptance; - $this->qty = $component->assets->first()?->pivot?->assigned_qty; + $this->qty = $component->checkout_qty; $this->settings = Setting::getSettings(); }