Added item and plant models #67

Merged
jothi merged 1 commits from ranjith-dev into master 2025-12-23 12:19:21 +00:00
2 changed files with 12 additions and 2 deletions

View File

@@ -3,15 +3,15 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Item extends Model class Item extends Model
{ {
use SoftDeletes; use SoftDeletes;
protected $fillable = [ protected $fillable = [
"plant_id", 'plant_id',
'category', 'category',
'code', 'code',
'description', 'description',
@@ -43,4 +43,9 @@ class Item extends Model
{ {
return $this->hasMany(TestingPanelReading::class); return $this->hasMany(TestingPanelReading::class);
} }
public function itemCharacteristics()
{
return $this->hasMany(ItemCharacteristic::class, 'item_id', 'id');
}
} }

View File

@@ -102,4 +102,9 @@ class Plant extends Model
{ {
return $this->hasMany(User::class, 'plant_id', 'id'); return $this->hasMany(User::class, 'plant_id', 'id');
} }
public function itemCharacteristics()
{
return $this->hasMany(ItemCharacteristic::class, 'plant_id', 'id');
}
} }