Description
When --soft-delete is used, generate a trash view with restore/permanently delete actions.
Current Behavior
--soft-delete adds SoftDeletes trait and migration column, but no UI for managing deleted records.
Expected Behavior
Generated Code
class Index extends Component
{
public string $view = 'active'; // 'active' | 'trash'
public function getQuery()
{
$query = Product::query();
if ($this->view === 'trash') {
$query->onlyTrashed();
}
return $query->when($this->search, ...)
->orderBy($this->sortField, $this->sortDirection)
->paginate($this->perPage);
}
public function restore(int $id): void
{
Product::withTrashed()->find($id)->restore();
session()->flash('success', 'Product restored.');
}
public function forceDelete(int $id): void
{
Product::withTrashed()->find($id)->forceDelete();
session()->flash('success', 'Product permanently deleted.');
}
}
Description
When
--soft-deleteis used, generate a trash view with restore/permanently delete actions.Current Behavior
--soft-deleteaddsSoftDeletestrait and migration column, but no UI for managing deleted records.Expected Behavior
Generated Code