haybea/laravel-trashcan
Composer 安装命令:
composer require haybea/laravel-trashcan
包简介
An observability & recovery console for Laravel soft-deleted records
README 文档
README
An observability & recovery console for Laravel soft-deleted records.
Laravel Trashcan provides a beautiful dashboard/console to manage your soft-deleted Eloquent records. Instead of digging through database tables or writing manual "Restore" logic, Trashcan gives you a central hub to visualize, restore, or permanently purge "trashed" data.
Features
- Centralized Dashboard: View all models using the
SoftDeletestrait in one place - Relationship Awareness: See which child records will be affected before you restore or purge a parent
- Safe by Default: Automatically restricted to local environments, with a simple Gate for production access
- Search & Filter: Filter by model type, deletion date, or search for specific IDs/attributes
- Bulk Operations: Restore or permanently delete multiple items at once
- Activity Logging: Track all restore and delete operations
- Export Functionality: Export trashed records to CSV or JSON
Installation
You can install the package via Composer. After the package is installed, publish its assets and configuration file.
composer require haybea/laravel-trashcan php artisan trashcan:install
Usage
Visit /trashcan in your browser to access the dashboard.
Registering Models
By default, Trashcan will attempt to find all models in your app/Models directory that use the SoftDeletes trait. If you have models in custom locations, you can define them in the config/trashcan.php file:
'only' => [ App\Models\User::class, App\Models\Post::class, // Add your custom models here ],
Alternatively, you can exclude specific models:
'exclude' => [ App\Models\SensitiveModel::class, ],
Configuration
Edit config/trashcan.php to customize Trashcan's behavior:
- Middleware: Add custom middleware for authentication/authorization
- Models: Configure which models to include/exclude
- Columns: Customize which columns to display per model
- Searchable: Define searchable columns per model
- Logging: Enable/disable activity logging
- Export: Configure export functionality
Authorization
By default, Trashcan only allows access in the local environment. To grant access in production, you should modify the gate method within your AppServiceProvider or create a custom service provider:
use Illuminate\Support\Facades\Gate; /** * Register the Trashcan gate. * * This gate determines who can access Trashcan in non-local environments. */ protected function gate(): void { Gate::define('viewTrashcan', function ($user) { return in_array($user->email, [ 'admin@yourdomain.com', ]); }); }
You can also configure per-model permissions in config/trashcan.php:
'model_permissions' => [ App\Models\User::class => [ 'view' => 'viewTrashedUsers', 'restore' => 'restoreUsers', 'delete' => 'forceDeleteUsers', ], ],
License
MIT
haybea/laravel-trashcan 适用场景与选型建议
haybea/laravel-trashcan 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 97 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「laravel」 「dashboard」 「trash」 「soft-deletes」 「trashcan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 haybea/laravel-trashcan 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 haybea/laravel-trashcan 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 haybea/laravel-trashcan 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
Analysis module for finding problematical shop data.
A short description of what your package does
Scout support for MoonShine
Production-ready Laravel Prometheus metrics package with built-in collectors for HTTP, database, cache, queue, events, errors, filesystem, and mail monitoring
Laravel Package for integrating Tabler template and this package is Laravel Mix friendly.
统计信息
- 总下载量: 97
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-06