From b0e2e9fe046221641c3f29d16292f5800d7a7f9e Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 23 Dec 2025 17:49:07 +0530 Subject: [PATCH] Added item and plant models --- app/Models/Item.php | 9 +++++++-- app/Models/Plant.php | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Models/Item.php b/app/Models/Item.php index c0631c6..7477b2a 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -3,15 +3,15 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\SoftDeletes; class Item extends Model { use SoftDeletes; protected $fillable = [ - "plant_id", + 'plant_id', 'category', 'code', 'description', @@ -43,4 +43,9 @@ class Item extends Model { return $this->hasMany(TestingPanelReading::class); } + + public function itemCharacteristics() + { + return $this->hasMany(ItemCharacteristic::class, 'item_id', 'id'); + } } diff --git a/app/Models/Plant.php b/app/Models/Plant.php index 19896e4..bc2b289 100644 --- a/app/Models/Plant.php +++ b/app/Models/Plant.php @@ -102,4 +102,9 @@ class Plant extends Model { return $this->hasMany(User::class, 'plant_id', 'id'); } + + public function itemCharacteristics() + { + return $this->hasMany(ItemCharacteristic::class, 'plant_id', 'id'); + } }