PHPackages                             devsarfo/laraprunable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. devsarfo/laraprunable

ActiveLibrary[Database &amp; ORM](/categories/database)

devsarfo/laraprunable
=====================

Laravel Prunable Package that supports SoftDeletes trait

1.2(5mo ago)012[1 PRs](https://github.com/devsarfo/laraprunable/pulls)MITPHPCI passing

Since Jan 11Pushed 2mo agoCompare

[ Source](https://github.com/devsarfo/laraprunable)[ Packagist](https://packagist.org/packages/devsarfo/laraprunable)[ Docs](https://github.com/devsarfo/laraprunable)[ RSS](/packages/devsarfo-laraprunable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (10)Used By (0)

LaraPrunable
============

[](#laraprunable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ceb58b5e962e4a906faf9505407fac3ca1e2ae4c63be4e5db9592ff2c656c27e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576736172666f2f6c6172617072756e61626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devsarfo/laraprunable)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c9e0917c91e53afbf0dfb9ef1c976e47614732721d3217589e91a47eba181e0c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f646576736172666f2f6c6172617072756e61626c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/devsarfo/laraprunable/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b9a9ad6577b0245876d21984eb476f0727ddd8e36a440befe9e2f39ee1c99cd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576736172666f2f6c6172617072756e61626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devsarfo/laraprunable)

A Laravel package that extends the built-in pruning functionality to support models using the `SoftDeletes` trait. This package allows you to safely prune (soft delete) records based on custom criteria without purging them from the database.

Features
--------

[](#features)

- **SoftDeletes Support**: Prune soft-deleted models without remove database records
- **Mass Pruning**: Efficiently prune large datasets in chunks
- **Laravel Integration**: Seamlessly extends Laravel's existing `php artisan model:prune` command

Installation
------------

[](#installation)

You can install the package via composer using the following command. The command will install the latest applicable version of the package.

```
composer require devsarfo/laraprunable
```

The package will automatically register its service provider and extend Laravel's prune command.

Requirements
------------

[](#requirements)

- Laravel 8.0 or higher

Usage
-----

[](#usage)

### 1. Add the Trait to Your Model

[](#1-add-the-trait-to-your-model)

Choose the appropriate trait based on your pruning needs:

#### For Individual Pruning (SoftPrunable)

[](#for-individual-pruning-softprunable)

Use this trait when you need to prune models one by one, which is useful for models with complex pruning logic or when you need to perform additional operations during pruning.

```
