Initial commit for new repo
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s

This commit is contained in:
dhanabalan
2025-12-16 17:05:04 +05:30
commit 3f0d529640
862 changed files with 141157 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class AlertMailRule extends Model
{
use SoftDeletes;
protected $fillable = [
'module',
'plant',
'rule_name',
'email',
'cc_emails',
'schedule_type',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
// public function plant(): BelongsTo
// {
// return $this->belongsTo(Plant::class);
// }
}

33
app/Models/Block.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Block extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'plant_id',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shifts(): HasMany
{
return $this->hasMany(Shift::class);
}
// public function lines(): HasMany
// {
// return $this->hasMany(Line::class);
// }
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class CheckPointName extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'name',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function checkPointTimes1()
{
return $this->hasMany(CheckPointTime::class, 'check_point1_id', 'id');
}
public function checkPointTimes2()
{
return $this->hasMany(CheckPointTime::class, 'check_point2_id', 'id');
}
public function guardPatrolEntries()
{
return $this->hasMany(GuardPatrolEntry::class, 'check_point_name_id', 'id');
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class CheckPointTime extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'check_point1_id',
'check_point2_id',
'sequence_number',
'time_lapse',
'time_lapse_cushioning',
'min_cushioning',
'max_cushioning',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function checkPointNames(): BelongsTo
{
//return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(CheckPointName::class);
}
public function checkPointNames1(): BelongsTo
{
//return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(CheckPointName::class, 'check_point1_id');
}
public function checkPointNames2(): BelongsTo
{
//return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(CheckPointName::class, 'check_point2_id');
}
}

View File

@@ -0,0 +1,174 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class ClassCharacteristic extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'machine_id',
'aufnr',
'class',
'arbid',
'gamng',
'lmnga',
'gernr',
'zz1_cn_bill_ord',
'zmm_amps',
'zmm_brand',
'zmm_degreeofprotection',
'zmm_delivery',
'zmm_dir_rot',
'zmm_discharge',
'zmm_discharge_max',
'zmm_discharge_min',
'zmm_duty',
'zmm_eff_motor',
'zmm_eff_pump',
'zmm_frequency',
'zmm_head',
'zmm_heading',
'zmm_head_max',
'zmm_head_minimum',
'zmm_idx_eff_mtr',
'zmm_idx_eff_pump',
'zmm_kvacode',
'zmm_maxambtemp',
'zmm_mincoolingflow',
'zmm_motorseries',
'zmm_motor_model',
'zmm_outlet',
'zmm_phase',
'zmm_pressure',
'zmm_pumpflowtype',
'zmm_pumpseries',
'zmm_pump_model',
'zmm_ratedpower',
'zmm_region',
'zmm_servicefactor',
'zmm_servicefactormaximumamps',
'zmm_speed',
'zmm_suction',
'zmm_suctionxdelivery',
'zmm_supplysource',
'zmm_temperature',
'zmm_thrustload',
'zmm_volts',
'zmm_wire',
'zmm_package',
'zmm_pvarrayrating',
'zmm_isi',
'zmm_isimotor',
'zmm_isipump',
'zmm_isipumpset',
'zmm_pumpset_model',
'zmm_stages',
'zmm_headrange',
'zmm_overall_efficiency',
'zmm_connection',
'zmm_min_bore_size',
'zmm_isireference',
'zmm_category',
'zmm_submergence',
'zmm_capacitorstart',
'zmm_capacitorrun',
'zmm_inch',
'zmm_motor_type',
'zmm_dismantle_direction',
'zmm_eff_ovrall',
'zmm_bodymoc',
'zmm_rotormoc',
'zmm_dlwl',
'zmm_inputpower',
'zmm_imp_od',
'zmm_ambtemp',
'zmm_de',
'zmm_dischargerange',
'zmm_efficiency_class',
'zmm_framesize',
'zmm_impellerdiameter',
'zmm_insulationclass',
'zmm_maxflow',
'zmm_minhead',
'zmm_mtrlofconst',
'zmm_nde',
'zmm_powerfactor',
'zmm_tagno',
'zmm_year',
'zmm_laser_name',
'zmm_beenote',
'zmm_beenumber',
'zmm_beestar',
'zmm_logo_ce',
'zmm_codeclass',
'zmm_colour',
'zmm_logo_cp',
'zmm_grade',
'zmm_grwt_pset',
'zmm_grwt_cable',
'zmm_grwt_motor',
'zmm_grwt_pf',
'zmm_grwt_pump',
'zmm_isivalve',
'zmm_isi_wc',
'zmm_labelperiod',
'zmm_length',
'zmm_license_cml_no',
'zmm_mfgmonyr',
'zmm_modelyear',
'zmm_motoridentification',
'zmm_newt_pset',
'zmm_newt_cable',
'zmm_newt_motor',
'zmm_newt_pf',
'zmm_newt_pump',
'zmm_logo_nsf',
'zmm_packtype',
'zmm_panel',
'zmm_performance_factor',
'zmm_pumpidentification',
'zmm_psettype',
'zmm_size',
'zmm_eff_ttl',
'zmm_type',
'zmm_usp',
'mark_status',
'marked_datetime',
'marked_by',
'man_marked_status',
'man_marked_datetime',
'man_marked_by',
'motor_marked_status',
'pump_marked_status',
'motor_pump_pumpset_status',
'part_validation_1',
'part_validation_2',
'samlight_logged_name',
'pending_released_status',
'expected_time',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
}

21
app/Models/Company.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Company extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
];
public function plants(): HasMany
{
return $this->hasMany(Plant::class);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Configuration extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'c_type',
'c_group',
'c_name',
'c_value',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class DeviceMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'name',
'mac_address',
'ip_address',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class DriverMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'identification1',
'identification2',
'identification3',
'contact_number',
'alternate_number',
'created_at',
'updated_at',
'created_by',
];
// VehicleMaster model
public function driverMaster()
{
return $this->belongsTo(DriverMaster::class, 'driver_master_id');
}
}

69
app/Models/EbReading.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class EbReading extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'lcd_segment_check',
'meter_serial_no',
'eb_date_time',
'ph_seq_of_volt',
'ph_assoc_conn_check',
'instantaneous_ph_volt',
'instantaneous_curr',
'instantaneous_freq',
'instantaneous_kw_with_sign',
'instantaneous_kva',
'instantaneous_kv_ar',
'instantaneous_pf_with_sign',
'rd_with_elapsed_time_kva',
'cum_active_import_energy',
'tod1_active_energy_6_9',
'tod2_active_energy_18_21',
'tod3_active_energy_21_22',
'tod4_active_energy_5_6_9_18',
'tod5_active_energy_22_5',
'cum_reac_lag_energy',
'cum_reac_lead_energy',
'cum_appar_energy',
'tod1_appar_energy_6_9',
'tod2_appar_energy_18_21',
'tod3_appar_energy_21_22',
'tod4_appar_energy_5_6_9_18',
'tod5_appar_energy_22_5',
'avg_pow_factor',
'avg_freq_15min_last_ip',
'net_kv_arh_high',
'net_kv_arh_low',
'cum_md_kva',
'present_md_kva',
'present_md_kva_date_time',
'tod1_md_kva_6_9',
'tod2_md_kva_18_21',
'tod3_md_kva_21_22',
'tod4_md_kva_5_6_9_18',
'tod5_md_kva_22_5',
'total_pow_off_hours',
'programming_count',
'last_occ_res_event_type',
'last_occ_res_event_date_time',
'tamper_count',
'reset_count',
'last_md_reset_date_time',
'electrician_sign',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class EquipmentMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'machine_id',
'name',
'description',
'make',
'model',
'equipment_number',
'instrument_serial_number',
'calibrated_on',
'frequency',
'next_calibration_date',
'calibrated_by',
'calibration_certificate',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
}

34
app/Models/GrMaster.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class GrMaster extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"item_id",
"serial_number",
"gr_number",
"created_at",
"created_by",
"updated_by",
"updated_at"
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

30
app/Models/GuardName.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class GuardName extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'name',
'identification1',
'identification2',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function guardPatrolEntries()
{
return $this->hasMany(GuardPatrolEntry::class, 'guard_name_id', 'id');
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\Builder;
class GuardPatrolEntry extends Model
{
use SoftDeletes;
use Prunable;
protected $fillable = [
'plant_id',
'guard_name_id',
'check_point_name_id',
'reader_code',
'patrol_time',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function guardNames(): BelongsTo
{
//return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(GuardName::class, 'guard_name_id');
}
public function checkPointNames(): BelongsTo
{
//return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(CheckPointName::class, 'check_point_name_id');
}
public function prunable(): Builder
{
// $start = now()->subMonth()->startOfMonth();
// $end = now()->subMonth()->endOfMonth();
// return static::whereBetween('created_at', [$start, $end]);
// Start of two months ago (first day of that month)
$startOfTwoMonthsAgo = now()->subMonthsNoOverflow(2)->startOfMonth();
// End of previous month (last day of last month)
$endOfPrevMonth = now()->subMonthNoOverflow()->endOfMonth();
return static::whereBetween('created_at', [$startOfTwoMonthsAgo, $endOfPrevMonth]);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class InvoiceDataValidation extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = [
'plant_id',
'distribution_channel_desc',
'customer_code',
'document_number',
'document_date',
'customer_trade_name',
'customer_location',
'location',
'created_at',
'created_by',
'updated_by',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class InvoiceOutValidation extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = [
"plant_id",
"qr_code",
"scanned_at",
"scanned_by",
"created_at",
"created_by",
"updated_by",
"updated_at"
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class InvoiceValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'sticker_master_id',
'plant_id',
'invoice_number',
'serial_number',
'motor_scanned_status',
'pump_scanned_status',
'capacitor_scanned_status',
'scanned_status_set',
'scanned_status',
'panel_box_supplier',
'panel_box_serial_number',
'load_rate',
'upload_status',
'batch_number',
'quantity',
'operator_id',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
public function stickerMasterRelation()
{
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
}
}

46
app/Models/Item.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Item extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
'category',
'code',
'description',
'hourly_quantity',
'uom',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function stickerMasters()
{
return $this->hasMany(StickerMaster::class, 'item_id', 'id');
}
public function productionQuantities()
{
return $this->hasMany(ProductionQuantity::class);
}
public function motorTestingMasters()
{
return $this->hasMany(MotorTestingMaster::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
}
}

151
app/Models/Line.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Line extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"name",
"type",
"group_work_center",
"no_of_operation",
"work_group1_id",
"work_group2_id",
"work_group3_id",
"work_group4_id",
"work_group5_id",
"work_group6_id",
"work_group7_id",
"work_group8_id",
"work_group9_id",
"work_group10_id",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
}
public function workGroupMasters(): BelongsTo
{
return $this->belongsTo(WorkGroupMaster::class);
}
public function workGroup1()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group1_id', 'id');
}
public function workGroup2()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group2_id', 'id');
}
public function workGroup3()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group3_id', 'id');
}
public function workGroup4()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group4_id', 'id');
}
public function workGroup5()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group5_id', 'id');
}
public function workGroup6()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group6_id', 'id');
}
public function workGroup7()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group7_id', 'id');
}
public function workGroup8()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group8_id', 'id');
}
public function workGroup9()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group9_id', 'id');
}
public function workGroup10()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group10_id', 'id');
}
public function workGroupMasters1()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group1_id', 'id');
}
public function workGroupMasters2()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group2_id', 'id');
}
public function workGroupMasters3()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group3_id', 'id');
}
public function workGroupMasters4()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group4_id', 'id');
}
public function workGroupMasters5()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group5_id', 'id');
}
public function workGroupMasters6()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group6_id', 'id');
}
public function workGroupMasters7()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group7_id', 'id');
}
public function workGroupMasters8()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group8_id', 'id');
}
public function workGroupMasters9()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group9 _id', 'id');
}
public function workGroupMasters10()
{
return $this->hasMany(WorkGroupMaster::class, 'work_group10_id', 'id');
}
// public function rejectReasons()
// {
// return $this->hasMany(RejectReason::class, 'line_id', 'id');
// }
}

22
app/Models/LineStop.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class LineStop extends Model
{
use SoftDeletes;
protected $fillable = [
"code",
"reason",
];
public function productionLineStops()
{
return $this->hasMany(ProductionLineStop::class, 'linestop_id');
}
}

24
app/Models/Locator.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Locator extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'locator_number',
'locator_quantity',
'operator_id',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class LocatorInvoiceValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'invoice_number',
'serial_number',
'pallet_number',
'locator_number',
'scanned_status',
'upload_status',
'created_at',
'updated_at',
'scanned_at',
'created_by',
'scanned_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

46
app/Models/Machine.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Machine extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'work_group_master_id',
'name',
'work_center',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function workGroupMaster(): BelongsTo
{
return $this->belongsTo(WorkGroupMaster::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
}
public function equipmentMasters()
{
return $this->hasMany(EquipmentMaster::class, 'machine_id', 'id');
}
}

33
app/Models/MfmMeter.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class MfmMeter extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'device_master_id',
'sequence',
'name',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function devicemaster(): BelongsTo
{
return $this->belongsTo(DeviceMaster::class, 'device_master_id');
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class MfmParameter extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'mfm_meter_id',
'device_master_id',
'name',
'register_id',
'identifier',
'byte_to_convert',
'type_to_convert',
'decimal_to_display',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function mfmMeter(): BelongsTo
{
return $this->belongsTo(MfmMeter::class, 'mfm_meter_id');
}
public function deviceName(): BelongsTo
{
return $this->belongsTo(DeviceMaster::class, 'device_master_id');
}
}

51
app/Models/MfmReading.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class MfmReading extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'mfm_meter_id',
'apparent_energy_received',
'reactive_energy_received',
'active_energy_received',
'active_power_r',
'active_power_y',
'active_power_b',
'active_power_total',
'voltage_ry',
'voltage_yb',
'voltage_br',
'current_r',
'current_y',
'current_b',
'current_n',
'voltage_r_n',
'voltage_y_n',
'voltage_b_n',
'frequency',
'power_factor_r',
'power_factor_y',
'power_factor_b',
'power_factor_total',
'created_at',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function mfmMeter(): BelongsTo
{
return $this->belongsTo(MfmMeter::class, 'mfm_meter_id');
}
}

19
app/Models/ModuleList.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ModuleList extends Model
{
use SoftDeletes;
protected $fillable = [
'module_name',
'dashboard_name',
'filter_name',
'created_by',
'updated_by',
];
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class MotorTestingMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'subassembly_code',
'isi_model',
'phase',
'kw',
'hp',
'volt',
'current',
'rpm',
'torque',
'frequency',
'connection',
'ins_res_limit',
'ins_res_type',
'routine_test_time',
'res_ry_ll',
'res_ry_ul',
'res_yb_ll',
'res_yb_ul',
'res_br_ll',
'res_br_ul',
'lock_volt_limit',
'leak_cur_limit',
'lock_cur_ll',
'lock_cur_ul',
'noload_cur_ll',
'noload_cur_ul',
'noload_pow_ll',
'noload_pow_ul',
'noload_spd_ll',
'noload_spd_ul',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class, 'item_id', 'id');
// return $this->belongsTo(Item::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class, 'motor_testing_master_id');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class OcrValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'gr_number',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class PalletValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'pallet_number',
'serial_number',
'pallet_status',
'locator_number',
'locator_quantity',
'created_at',
'updated_at',
'scanned_at',
'created_by',
'scanned_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

105
app/Models/Plant.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Plant extends Model
{
use SoftDeletes;
protected $fillable = [
'code',
'company_id',
'name',
'address',
];
public function company(): BelongsTo
{
return $this->belongsTo(Company::class);
}
public function blocks(): HasMany
{
return $this->hasMany(Block::class);
}
public function lines(): HasMany
{
return $this->hasMany(Line::class);
}
public function getLineNames()
{
return $this->hasMany(Line::class, 'plant_id', 'id');
}
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');
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);
}
public function guardNames()
{
return $this->hasMany(GuardName::class, 'plant_id', 'id');
}
public function checkPointNames()
{
return $this->hasMany(CheckPointName::class, 'plant_id', 'id');
}
public function checkPointTimes()
{
return $this->hasMany(CheckPointTime::class, 'plant_id', 'id');
}
public function guardPatrolEntries()
{
return $this->hasMany(GuardPatrolEntry::class, 'plant_id', 'id');
}
public function workGroupMasters()
{
return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id');
}
public function equipmentMasters()
{
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
}
// public function rejectReasons()
// {
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
// }
public function users()
{
return $this->hasMany(User::class, 'plant_id', 'id');
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProcessOrder extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'process_order',
'coil_number',
'order_quantity',
'received_quantity',
'sfg_number',
'machine_name',
'created_at',
'created_by',
'updated_by',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item()
{
return $this->belongsTo(Item::class, 'item_id');
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class ProductCharacteristicsMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'item_id',
'work_group_master_id',
'machine_id',
'name',
'inspection_type',
'characteristics_type',
'upper',
'lower',
'middle',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function workGroupMaster(): BelongsTo
{
return $this->belongsTo(WorkGroupMaster::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
// public function machine()
// {
// return $this->belongsTo(\App\Models\Machine::class, 'machine_id');
// }
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProductionLineStop extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"shift_id",
"line_id",
"linestop_id",
"from_datetime",
"to_datetime",
"stop_hour",
"stop_min",
"operator_id",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function linestop(): BelongsTo
{
return $this->belongsTo(LineStop::class);
}
// //..this is my code below
// public function lineStopRelation()
// {
// return $this->belongsTo(LineStop::class, 'linestop_id');
// }
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProductionPlan extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"shift_id",
"created_at",
"line_id",
"plan_quantity",
"production_quantity",
"operator_id",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Models;
use Carbon\Carbon;
use Filament\Facades\Filament;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProductionQuantity extends Model
{
use SoftDeletes;
public static $importing = false; // Add this flag
protected $fillable = [
"plant_id",
"shift_id",
"line_id",
"item_id",
"serial_number",
"production_order",
"operator_id",
// "success_status",
// "no_of_employee",
// "list_of_employee",
"created_at",
"updated_at"
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
protected static function booted()
{
static::created(function ($productionQuantity) {
if (static::$importing) { // Check flag here
return;
}
$productionPlan = ProductionPlan::where('plant_id', $productionQuantity->plant_id)
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
->whereDate('created_at', today())
// ->where('plan_quantity', $productionQuantity->plan_quantity)
->latest()
->first();
if (!$productionPlan)
{
$productionPlan = ProductionPlan::where('plant_id', $productionQuantity->plant_id)
->where('shift_id', $productionQuantity->shift_id)
->where('line_id', $productionQuantity->line_id)
->whereDate('created_at', Carbon::yesterday())
// ->where('plan_quantity', $productionQuantity->plan_quantity)
->latest()
->first();
}
$operatorName = Filament::auth()->user()->name;
if ($productionPlan) {
$productionPlan->update([
'production_quantity' => $productionPlan->production_quantity + 1,
'updated_at' => now(),
// 'operator_id'=> $operatorName,
]);
}
});
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class QualityValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'sticker_master_id',
'plant_id',
'line_id',
'production_order',
'serial_number_motor',
'serial_number_pump',
'serial_number_pumpset',
'pack_slip_motor',
'pack_slip_pump',
'pack_slip_pumpset',
'name_plate_motor',
'name_plate_pump',
'name_plate_pumpset',
'tube_sticker_motor',
'tube_sticker_pump',
'tube_sticker_pumpset',
'warranty_card',
'part_validation1',
'part_validation2',
'part_validation3',
'part_validation4',
'part_validation5',
'operator_id',
'uom',
'created_at',
'updated_at',
'serial_number',
'sap_msg_status',
'sap_msg_description',
];
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class RejectReason extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'work_group_master_id',
'code',
'reason',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function workGroupMaster(): BelongsTo
{
return $this->belongsTo(WorkGroupMaster::class);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class ReworkLocatorInvoiceValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'invoice_number',
'serial_number',
'pallet_number',
'locator_number',
'scanned_status',
'upload_status',
'created_by',
'scanned_by',
'updated_by',
'reworked_by',
'created_at',
'updated_at',
'scanned_at',
'reworked_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class SerialValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'sticker_master_id',
'plant_id',
'invoice_number',
'serial_number',
'motor_scanned_status',
'pump_scanned_status',
'capacitor_scanned_status',
'scanned_status_set',
'scanned_status',
'panel_box_supplier',
'panel_box_serial_number',
'load_rate',
'upload_status',
'batch_number',
'quantity',
'operator_id',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
public function stickerMasterRelation()
{
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
}
}

36
app/Models/Shift.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Shift extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'block_id',
'name',
'start_time',
'duration',
'end_time',
];
// public function plant(): BelongsTo
// {
// return $this->belongsTo(Plant::class);
// }
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class StickerMappingMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'item_id',
'sticker1',
'sticker2',
'sticker3',
'sticker4',
'sticker5',
'created_at',
'updated_at',
'created_by',
'updated_by'
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class StickerMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'item_id',
'plant_id',
'panel_box_code',
'serial_number_motor',
'serial_number_pump',
'serial_number_pumpset',
'pack_slip_motor',
'pack_slip_pump',
'pack_slip_pumpset',
'name_plate_motor',
'name_plate_pump',
'name_plate_pumpset',
'tube_sticker_motor',
'tube_sticker_pump',
'tube_sticker_pumpset',
'warranty_card',
'part_validation1',
'part_validation2',
'part_validation3',
'part_validation4',
'part_validation5',
'laser_part_validation1',
'laser_part_validation2',
'load_rate',
'bundle_quantity',
'material_type',
];
public function item()
{
return $this->belongsTo(Item::class, 'item_id', 'id');
// return $this->belongsTo(Item::class);
}
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function qualityValidations()
{
return $this->hasMany(QualityValidation::class, 'sticker_master_id');
}
public function invoiceValidations()
{
return $this->hasMany(InvoiceValidation::class, 'sticker_master_id');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class StickerPrinting extends Model
{
//
use SoftDeletes;
protected $fillable = [
'plant_id',
'reference_number',
'serial_number',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class TempLiveReading extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'mfm_meter_id',
'register_data',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function mfmMeter(): BelongsTo
{
return $this->belongsTo(MfmMeter::class, 'mfm_meter_id');
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class TestingPanelReading extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'motor_testing_master_id',
'machine_id',
'output',
'serial_number',
'winded_serial_number',
'before_fr_volt',
'before_fr_cur',
'before_fr_pow',
'before_fr_res_ry',
'before_fr_res_yb',
'before_fr_res_br',
'before_fr_ir',
'before_fr_ir_r',
'before_fr_ir_y',
'before_fr_ir_b',
'before_fr_freq',
'before_fr_speed',
'after_fr_vol',
'after_fr_cur',
'after_fr_pow',
'after_fr_ir_hot',
'after_fr_ir_hot_r',
'after_fr_ir_hot_y',
'after_fr_ir_hot_b',
'after_fr_ir_cool',
'after_fr_ir_cool_r',
'after_fr_ir_cool_y',
'after_fr_ir_cool_b',
'after_fr_freq',
'after_fr_speed',
'after_fr_leak_cur',
'locked_rt_volt',
'locked_rt_cur',
'locked_rt_pow',
'no_load_pickup_volt',
'room_temperature',
'hv_test',
'batch_number',
'batch_count',
'result',
'remark',
'rework_count',
'update_count',
'output_flag',
'tested_by',
'updated_by',
'created_at',
'updated_at',
'scanned_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function motorTestingMaster()
{
return $this->belongsTo(MotorTestingMaster::class);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class TrackingDeviceMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'status',
'serial_number',
'created_at',
'updated_at',
'created_by',
];
}

66
app/Models/User.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Althinect\FilamentSpatieRolesPermissions\Concerns\HasSuperAdmin;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class User extends Authenticatable implements FilamentUser
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, HasRoles, Notifiable, SoftDeletes, HasSuperAdmin;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'plant_id',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function canAccessPanel(Panel $panel): bool
{
return true;
}
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class VehicleMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'driver_master_id',
'tracking_device_master_id',
'registration_number',
'model',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function driverMaster(): BelongsTo
{
return $this->belongsTo(DriverMaster::class);
}
public function trackingDeviceMaster(): BelongsTo
{
return $this->belongsTo(TrackingDeviceMaster::class);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class VehicleTracking extends Model
{
use SoftDeletes;
protected $fillable = [
'vehicle_master_id',
'latitude',
'longitude',
'accuracy',
'status',
'distance_covered_km',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function vehicleMaster(): BelongsTo
{
return $this->belongsTo(VehicleMaster::class);
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\Builder;
class WeightValidation extends Model
{
use SoftDeletes;
use Prunable;
protected $fillable = [
'plant_id',
'item_id',
'obd_number',
'line_number',
'batch_number',
'heat_number',
'obd_weight',
'vehicle_number',
'bundle_number',
'picked_weight',
'scanned_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function prunable(): Builder
{
$startOfTwoMonthsAgo = now()->subMonthsNoOverflow(3)->startOfMonth();
$endOfPrevMonth = now()->subMonthNoOverflow()->endOfMonth();
return static::whereBetween('created_at', [$startOfTwoMonthsAgo, $endOfPrevMonth]);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class WorkGroupMaster extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'name',
'description',
'operation_number',
'created_at',
'updated_at',
'created_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
// public function rejectReasons()
// {
// return $this->hasMany(RejectReason::class, 'work_group_master_id', 'id');
// }
}