From f082587ef4069399190d471d3e7d229273e4278c Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 6 Jun 2026 16:36:02 +0530 Subject: [PATCH 1/2] Updated created_by and updated_by column value passing logic --- .../Imports/MotorTestingMasterImporter.php | 47 +++++++------------ 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/app/Filament/Imports/MotorTestingMasterImporter.php b/app/Filament/Imports/MotorTestingMasterImporter.php index 3cf311e..ed5dbe4 100644 --- a/app/Filament/Imports/MotorTestingMasterImporter.php +++ b/app/Filament/Imports/MotorTestingMasterImporter.php @@ -216,18 +216,18 @@ class MotorTestingMasterImporter extends Importer ->label('Plant Code') ->relationship(resolveUsing: 'code') ->rules(['required']), - ImportColumn::make('created_by') - ->requiredMapping() - ->exampleHeader('Created By') - ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name]) - ->label('Created By') - ->rules(['required']), - ImportColumn::make('updated_by') - ->requiredMapping() - ->exampleHeader('Updated By') - ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name]) - ->label('Updated By') - ->rules(['required']), + // ImportColumn::make('created_by') + // ->requiredMapping() + // ->exampleHeader('Created By') + // ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name]) + // ->label('Created By') + // ->rules(['required']), + // ImportColumn::make('updated_by') + // ->requiredMapping() + // ->exampleHeader('Updated By') + // ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name]) + // ->label('Updated By') + // ->rules(['required']), ]; } @@ -266,8 +266,8 @@ class MotorTestingMasterImporter extends Importer $noloadPowUl = trim($this->data['noload_pow_ul']); $noloadSpdLl = trim($this->data['noload_spd_ll']); $noloadSpdUl = trim($this->data['noload_spd_ul']); - $createdBy = trim($this->data['created_by']); - $updatedBy = trim($this->data['updated_by']); + $createdBy = Filament::auth()->user()->name; + $updatedBy = Filament::auth()->user()->name; $plant = null; if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) { @@ -387,19 +387,8 @@ class MotorTestingMasterImporter extends Importer $created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null; if (! $created) { $warnMsg[] = 'Created by not found on update'; - } - $updated = User::where('name', $updatedBy)->first(); - if (! $updated) { - $warnMsg[] = 'Updated by not found on update'; - } - } else { - $created = User::where('name', $createdBy)->first(); - if (! $created) { - $warnMsg[] = 'Created by not found'; - } - $updated = User::where('name', $updatedBy)->first(); - if (! $updated) { - $warnMsg[] = 'Updated by not found'; + } else { + $createdBy = $created->name; } } } @@ -444,8 +433,8 @@ class MotorTestingMasterImporter extends Importer 'noload_pow_ul' => $noloadPowUl, 'noload_spd_ll' => $noloadSpdLl, 'noload_spd_ul' => $noloadSpdUl, - 'created_by' => $created->name, - 'updated_by' => $updated->name, + 'created_by' => $createdBy, + 'updated_by' => $updatedBy, ] ); -- 2.49.1 From 3bce7a1b0acaf405e9eee98b523e4606c9db8d88 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 6 Jun 2026 16:47:09 +0530 Subject: [PATCH 2/2] Solved line and work group master load issue --- app/Filament/Resources/MachineResource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Filament/Resources/MachineResource.php b/app/Filament/Resources/MachineResource.php index 06cd34c..bffe57e 100644 --- a/app/Filament/Resources/MachineResource.php +++ b/app/Filament/Resources/MachineResource.php @@ -75,7 +75,7 @@ class MachineResource extends Resource ->hintColor('danger'), Forms\Components\Select::make('line_id') ->label('Line Name') - ->relationship('line', 'name') + // ->relationship('line', 'name') ->searchable() ->required() ->columnSpan(1) @@ -116,7 +116,7 @@ class MachineResource extends Resource ->hintColor('danger'), Forms\Components\Select::make('work_group_master_id') ->label('Group Work Center') - ->relationship('workGroupMaster', 'name') + // ->relationship('workGroupMaster', 'name') ->searchable() ->required() ->columnSpan(1) -- 2.49.1