1
0
forked from poc/pds

Loading foreign key value while update

This commit is contained in:
dhanabalan
2025-04-01 16:16:37 +05:30
parent 6160d91357
commit a8b34fe1f3
6 changed files with 207 additions and 212 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Plant;
use Filament\Forms;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ImportAction;
@@ -69,6 +70,7 @@ class PlantResource extends Resource
->relationship('company', 'name')
->required()
->reactive()
->disabled(fn (Get $get) => !empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$companyId = $get('company_id');
// Ensure `linestop_id` is not cleared
@@ -132,6 +134,9 @@ class PlantResource extends Resource
])
->hint(fn ($get) => $get('pAddressError') ? $get('pAddressError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
])
->columns(2),
]);