konnco/filament-safely-delete

4,283 34
Install
composer require konnco/filament-safely-delete
Latest Version:0.3.2
PHP:^8.0
License:MIT
Last Updated:Oct 9, 2023
Links: GitHub  ·  Packagist
Maintainer: frankyso.pg

Screenshot of Login

Filament Confirm Delete

Code Styles run-tests

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:

composer require konnco/filament-safely-delete

Usage

import the actions into the Resource page

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.

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

use Konnco\FilamentSafelyDelete\Pages\Concerns\HasRevertableRecord;

class ListBlogPosts extends ListRecords
{
    use HasRevertableRecord;

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Contributors

Related Packages

nicklayb/laravel-db-import

Laravel database import package for easy manipulations

9,913 2
highsolutions/laravel-lang-import-export

A Laravel package providing artisan commands to import and export language files...

339,763 24
maatwebsite/excel

Supercharged Excel exports and imports in Laravel

170,865,687 12,705
cyber-duck/laravel-excel

This package provides a way to export an Eloquent collection as an excel file an...

233,111 74
ufirst/lang-import-export

A Laravel package providing artisan commands to import and export language files...

236,086 41