Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/konnco/filament-safely-delete


https://github.com/konnco/filament-safely-delete

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

![Screenshot of Login](./art/screenshot.png)

# Filament Confirm Delete


FILAMENT 2.x


Packagist


Downloads

[![Code Styles](https://github.com/konnco/filament-safely-delete/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/konnco/filament-safely-delete/actions/workflows/php-cs-fixer.yml)
[![run-tests](https://github.com/konnco/filament-safely-delete/actions/workflows/run-tests.yml/badge.svg)](https://github.com/konnco/filament-safely-delete/actions/workflows/run-tests.yml)

This plugin is intended for those of you who are worried about your data being accidentally deleted.

## Installation

You can install the package via composer:

```bash
composer require konnco/filament-safely-delete
```

## Usage

import the actions into the `Resource` page

```php
use Konnco\FilamentSafelyDelete\Tables\Actions\RevertableDeleteAction;

class PostResource extends Resource
{
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
Tables\Columns\TextColumn::make('slug'),
Tables\Columns\TextColumn::make('body'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
DeleteAction::make()
->usingField('title')
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
}
```

### Undo Delete
You can also use to delete undo in your resource.

```php
use Konnco\FilamentSafelyDelete\Tables\Actions\RevertableDeleteAction;

class PostResource extends Resource
{
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
Tables\Columns\TextColumn::make('slug'),
Tables\Columns\TextColumn::make('body'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
RevertableDeleteAction::make()
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
}
```

and implementing `HasRevertableRecord` traits in your `ListRecords`
```php
use Konnco\FilamentSafelyDelete\Pages\Concerns\HasRevertableRecord;

class ListBlogPosts extends ListRecords
{
use HasRevertableRecord;
```

## Testing

```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](https://github.com/konnco/.github/blob/main/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

### Contributors



Franky


Franky So




Herbert


Herbert Maschke




abangijal/


abangijal



frankyso


Franky So




thyseus


Herbert Maschke




ijalnasution


Abangijal