Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/konnco/filament-safely-delete
https://github.com/konnco/filament-safely-delete
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/konnco/filament-safely-delete
- Owner: konnco
- License: mit
- Created: 2022-09-26T06:57:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T23:10:51.000Z (about 1 year ago)
- Last Synced: 2024-08-03T03:02:07.702Z (5 months ago)
- Language: PHP
- Size: 284 KB
- Stars: 32
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-filament - konnco/filament-safely-delete - A delete-safety with name input to confirm. (UI)
README
![Screenshot of Login](./art/screenshot.png)
# Filament Confirm Delete
[![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