F
Filamentβ€’10mo ago
Zakhaev

problem when editing or viewing deleted records

I have just a resource with records. But when i delete one and try to edit or view it i get a 404. What can i do to solve this problem. Im using softdeletes to delete a record The code is just a normal resource nothing special or extra
5 Replies
Forever
Foreverβ€’10mo ago
i guess you are using softdeletes ? otherwise there is nothing to edit
Zakhaev
ZakhaevOPβ€’10mo ago
Yes, im using softdeletes this is my resource if it helps
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Naam')
->searchable(['name'])
->sortable(['name']),
Tables\Columns\TextColumn::make('users_count')
->label('Leden')
->counts('users'),
Tables\Columns\TextColumn::make('starting_date')->date()
->label('Ingangsdatum'),
Tables\Columns\TextColumn::make('ending_date')->date()
->label('Vervaldatum'),
])
->defaultSort('name', 'desc')
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Naam')
->searchable(['name'])
->sortable(['name']),
Tables\Columns\TextColumn::make('users_count')
->label('Leden')
->counts('users'),
Tables\Columns\TextColumn::make('starting_date')->date()
->label('Ingangsdatum'),
Tables\Columns\TextColumn::make('ending_date')->date()
->label('Vervaldatum'),
])
->defaultSort('name', 'desc')
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
Anyone πŸ˜…
toeknee
toekneeβ€’10mo ago
Please read the documenation, it explains how to use soft deletes and the trashed filter
Zakhaev
ZakhaevOPβ€’10mo ago
I found the problem It was a global filter in the model being added and it made the records unavailable.
Want results from more Discord servers?
Add your server