ranjith-dev #1270
@@ -184,6 +184,30 @@ class PlantResource extends Resource
|
||||
])
|
||||
->hint(fn ($get) => $get('pAddressError') ? $get('pAddressError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Textarea::make('reg_address')
|
||||
->required()
|
||||
->label('Reg Address')
|
||||
->placeholder('Scan the valid Regd address')
|
||||
->unique(ignoreRecord: true)
|
||||
->columnSpanFull()
|
||||
->reactive()
|
||||
->minLength(5)
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$nameId = $get('address');
|
||||
// Ensure `linestop_id` is not cleared
|
||||
if (! $nameId) {
|
||||
$set('pRegAddressError', 'Scan the valid reg address.');
|
||||
|
||||
return;
|
||||
} else {
|
||||
$set('pRegAddressError', null);
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('pRegAddressError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('pRegAddressError') ? $get('pRegAddressError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
@@ -233,6 +257,11 @@ class PlantResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('reg_address')
|
||||
->label('Regd Address')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('company.name')
|
||||
->label('Company')
|
||||
->alignCenter()
|
||||
|
||||
@@ -17,6 +17,7 @@ class Plant extends Model
|
||||
'name',
|
||||
'address',
|
||||
'warehouse_number',
|
||||
'reg_address',
|
||||
];
|
||||
|
||||
public function company(): BelongsTo
|
||||
@@ -194,6 +195,11 @@ class Plant extends Model
|
||||
return $this->hasMany(TempStopCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
// public function laserAxisPositionMasters()
|
||||
// {
|
||||
// return $this->hasMany(LaserAxisPositionMaster::class, 'plant_id', 'id');
|
||||
// }
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class, 'plant_id', 'id');
|
||||
@@ -249,4 +255,8 @@ class Plant extends Model
|
||||
return $this->hasMany(StickerOrder::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function ItemCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ItemCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE plants
|
||||
ADD COLUMN reg_address TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('plants', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user