From f08714e2a304f130deba4c9519ca1f5733d3fec7 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 6 May 2025 12:17:49 +0530 Subject: [PATCH] Added hasMany relations --- app/Models/Plant.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/Models/Plant.php b/app/Models/Plant.php index 6685a97..d121126 100644 --- a/app/Models/Plant.php +++ b/app/Models/Plant.php @@ -37,4 +37,24 @@ class Plant extends Model { return $this->hasMany(Line::class, 'plant_id', 'id'); // Ensure 'plant_id' is the foreign key in 'lines' table } + + public function items(): HasMany + { + return $this->hasMany(Item::class); + } + + public function stickersMasters(): HasMany + { + return $this->hasMany(StickerMaster::class); + } + + public function invoiceValidations() + { + return $this->hasMany(InvoiceValidation::class, 'sticker_master_id'); + } + + public function qualityValidations() + { + return $this->hasMany(QualityValidation::class, 'sticker_master_id'); + } }