hasMany(InvoiceItem::class)->orderBy('id', 'ASC'); } // NEW: invoice आता container वर depend public function container() { return $this->belongsTo(Container::class); } // OLD: order() relation काढले आहे // public function order() // { // return $this->belongsTo(Order::class); // } public function customer() { return $this->belongsTo(User::class, 'customer_id'); } public function installments() { return $this->hasMany(InvoiceInstallment::class); } /**************************** * Helper Functions ****************************/ // Auto calculate GST fields (you can call this in controller before saving) public function calculateTotals() { $gst = ($this->final_amount * $this->gst_percent) / 100; $this->gst_amount = $gst; $this->final_amount_with_gst = $this->final_amount + $gst; } // Check overdue status condition public function isOverdue() { return $this->status === 'pending' && now()->gt($this->due_date); } // जर पुढे container → shipment relation असेल तर हा helper नंतर adjust करू public function getShipment() { // आधी order वरून shipment घेत होत; container flow मध्ये नंतर गरज पडल्यास बदलू return null; } }