Hi all - I'm not sure if this is a bug or my implementation, but:
click row 1 of record to edit. SlideOver is displayed with correct data. Click Cancel or the X of the slideOver.
click row 2 of record to edit. SlideOver is displayed with data from row 1. This is of course incorrect.
Perform the same 2 tests but instead of Cancel, click Save changes and the correct data is returned in the modal for both tests.
Any help greatly appreciated!
Below is a my standard filament resource:
Laravel Framework v12.19.3
Filament v3.2
class BusinessStageResource extends Resource
{
use HasModeFieldTrait, HasAdminSettingField;
protected static ?string $model = BusinessStage::class;
protected static ?string $modelLabel = 'Business Stage';
protected static ?string $pluralModelLabel = 'Business Stages';
protected static ?string $navigationGroup = 'Core Tables';
protected static ?string $navigationLabel = 'Business Stages';
protected static ?int $navigationSort = 1;
public static function getEloquentQuery(): Builder
{
$settings = app('settings');
$query = parent::getEloquentQuery()
->whereHas('adminSetting', function (Builder $q) {
$q->activeAppointedRepresentatives();
});
return $query->orderBy('admin_setting_id')->orderBy('id', 'desc');
}
public static function form(Form $form): Form
{
$settings = app('settings');
return $form
->schema([
Section::make()
->schema([
Grid::make(1)
->schema([
(new self())->adminSettingSelect($settings),
TextInput::make('business_stage')
->label('Business Stage')
->placeholder('Business Stage')
->validationAttribute('business stage')
->required()
->maxLength(191)
->unique(
ignoreRecord: true,
modifyRuleUsing: HasAdminSettingField::adminSettingUniqueRule($settings)
),
(new self())->modeField(),
]),
]),
]);
}
public static function table(Table $table): Table
{
$settings = app('settings');
return $table
->defaultPaginationPageOption(25)
->columns([
TextColumn::make('id')
->toggleable()
->label('ID')
->sortable(),
(new self())->adminSettingTextColumn('adminSetting.title', $settings),
TextColumn::make('business_stage')
->label('Business Stage')
->sortable()
->searchable(),
(new self())->modeColumn(),
TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->modifyQueryUsing(function (Builder $query) use ($settings) {
if ($settings->is_master === 'no') {
return $query->where('admin_setting_id', $settings->id);
}
})
->filters([
(new self())->adminSettingSelectFilter('adminSetting', $settings),
(new self())->modeFilter(),
])
->actions([
Tables\Actions\EditAction::make()
->modalWidth(MaxWidth::Large)
->slideOver(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getPages(): array
{
return [
'index' => Pages\ListBusinessStages::route('/'),
// 'create' => Pages\CreateBusinessStage::route('/create'),
// 'edit' => Pages\EditBusinessStage::route('/{record}/edit'),
];
}
}