Added columns in model files of Item and line and production plan and production quantity
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-02-19 11:29:02 +05:30
parent b9812cbe32
commit 5ba59e10bd
4 changed files with 44 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ class Item extends Model
protected $fillable = [ protected $fillable = [
'plant_id', 'plant_id',
'line_id',
'category', 'category',
'code', 'code',
'description', 'description',
@@ -19,11 +20,16 @@ class Item extends Model
'uom', 'uom',
]; ];
public function plant(): BelongsTo public function plant()
{ {
return $this->belongsTo(Plant::class); return $this->belongsTo(Plant::class);
} }
public function item()
{
return $this->belongsTo(Item::class, 'item_id', 'id');
}
public function stickerMasters() public function stickerMasters()
{ {
return $this->hasMany(StickerMaster::class, 'item_id', 'id'); return $this->hasMany(StickerMaster::class, 'item_id', 'id');

View File

@@ -3,30 +3,32 @@
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\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Line extends Model class Line extends Model
{ {
use SoftDeletes; use SoftDeletes;
protected $fillable = [ protected $fillable = [
"plant_id", 'plant_id',
"name", 'block_id',
"type", 'name',
"group_work_center", 'type',
"no_of_operation", 'line_capacity',
"work_group1_id", 'group_work_center',
"work_group2_id", 'no_of_operation',
"work_group3_id", 'work_group1_id',
"work_group4_id", 'work_group2_id',
"work_group5_id", 'work_group3_id',
"work_group6_id", 'work_group4_id',
"work_group7_id", 'work_group5_id',
"work_group8_id", 'work_group6_id',
"work_group9_id", 'work_group7_id',
"work_group10_id", 'work_group8_id',
'work_group9_id',
'work_group10_id',
]; ];
public function plant(): BelongsTo public function plant(): BelongsTo
@@ -34,6 +36,11 @@ class Line extends Model
return $this->belongsTo(Plant::class); return $this->belongsTo(Plant::class);
} }
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function testingPanelReadings() public function testingPanelReadings()
{ {
return $this->hasMany(TestingPanelReading::class); return $this->hasMany(TestingPanelReading::class);

View File

@@ -16,9 +16,12 @@ class ProductionPlan extends Model
protected $fillable = [ protected $fillable = [
'plant_id', 'plant_id',
'shift_id', 'shift_id',
'item_id',
'line_id', 'line_id',
'plan_quantity', 'plan_quantity',
'production_quantity', 'production_quantity',
'working_days',
'leave_dates',
'operator_id', 'operator_id',
'created_at', 'created_at',
'updated_at', 'updated_at',
@@ -39,6 +42,11 @@ class ProductionPlan extends Model
return $this->belongsTo(Line::class); return $this->belongsTo(Line::class);
} }
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function prunable(): Builder public function prunable(): Builder
{ {
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6)); return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));

View File

@@ -22,6 +22,7 @@ class ProductionQuantity extends Model
'shift_id', 'shift_id',
'line_id', 'line_id',
'item_id', 'item_id',
'machine_id',
'serial_number', 'serial_number',
'production_order', 'production_order',
'operator_id', 'operator_id',
@@ -53,6 +54,11 @@ class ProductionQuantity extends Model
return $this->belongsTo(Item::class); return $this->belongsTo(Item::class);
} }
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
protected static function booted() protected static function booted()
{ {
static::created(function ($productionQuantity) { static::created(function ($productionQuantity) {