Loading foreign key value while update
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Filament\Resources\BlockResource\Pages;
|
||||
use App\Models\Block;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
@@ -58,6 +59,7 @@ class BlockResource extends Resource
|
||||
// ->unique(ignoreRecord: true)
|
||||
->required()
|
||||
->reactive()
|
||||
->disabled(fn (Get $get) => !empty($get('id')))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$nameId = $get('plant_id');
|
||||
// Ensure `linestop_id` is not cleared
|
||||
@@ -75,6 +77,9 @@ class BlockResource extends Resource
|
||||
])
|
||||
->hint(fn ($get) => $get('bPlantError') ? $get('bPlantError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user