Loading foreign key value while update
This commit is contained in:
@@ -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),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user