diff --git a/app/Filament/Resources/StickerMasterResource.php b/app/Filament/Resources/StickerMasterResource.php index 4d07871..6c20f4e 100644 --- a/app/Filament/Resources/StickerMasterResource.php +++ b/app/Filament/Resources/StickerMasterResource.php @@ -7,6 +7,7 @@ use App\Filament\Resources\StickerMasterResource\RelationManagers; use App\Models\StickerMaster; use Filament\Forms; use Filament\Forms\Form; +use Filament\Forms\Get; use Filament\Resources\Resource; use Filament\Tables; use Filament\Tables\Table; @@ -31,6 +32,7 @@ class StickerMasterResource extends Resource ->relationship('plant', 'name') ->reactive() ->nullable() + ->disabled(fn (Get $get) => !empty($get('id'))) ->afterStateUpdated(fn (callable $set) => $set('item_id', null) & $set('item_description', null) ) @@ -51,6 +53,7 @@ class StickerMasterResource extends Resource ->nullable() ->searchable() ->reactive() + ->disabled(fn (Get $get) => !empty($get('id'))) ->live(debounce: 500) // Enable live updates ->afterStateUpdated(function ($state, callable $set, callable $get) { $plantId = $get('plant_id'); // Get selected plant_id @@ -180,6 +183,9 @@ class StickerMasterResource extends Resource Forms\Components\Checkbox::make('warranty_card') ->nullable() ->dehydrateStateUsing(fn ($state) => $state ? $state : null), + Forms\Components\TextInput::make('id') + ->hidden() + ->readOnly(), ]); }