PHPackages                             jeanlrnt/laravel-cancellable - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jeanlrnt/laravel-cancellable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jeanlrnt/laravel-cancellable
============================

An cancellable trait package for Laravel Eloquent models

1.3(2y ago)066MITPHPPHP ^7.3|^8.0

Since Oct 11Pushed 5mo agoCompare

[ Source](https://github.com/jeanlrnt/laravel-cancellable)[ Packagist](https://packagist.org/packages/jeanlrnt/laravel-cancellable)[ Docs](https://github.com/jeanlrnt/laravel-cancellable)[ RSS](/packages/jeanlrnt-laravel-cancellable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

[![Build Status](https://github.com/jeanlrnt/laravel-cancellable/workflows/tests/badge.svg)](https://github.com/jeanlrnt/laravel-cancellable/actions)[![Total Downloads](https://camo.githubusercontent.com/7ad8afce2e20cf07f3dea2787d02f9d9de62f920ada8109236409c24130b0378/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a65616e6c726e742f6c61726176656c2d63616e63656c6c61626c65)](https://packagist.org/packages/jeanlrnt/laravel-cancellable)[![Last stable version](https://camo.githubusercontent.com/026167e8913fc882edcfd3f157a4baa9bac6c6ca1238a785be32cf335fc6f951/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65616e6c726e742f6c61726176656c2d63616e63656c6c61626c65)](https://packagist.org/packages/jeanlrnt/laravel-cancellable)[![Code Coverage](https://camo.githubusercontent.com/d894ec38ebb7944125b5917e63f88884b4b0731ca2276cd094209e1f00dee7e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a65616e6c726e742f6c61726176656c2d63616e63656c6c61626c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jeanlrnt/laravel-cancellable/?branch=master)[![License](https://camo.githubusercontent.com/fe0f76214ffa0ec0a1e0a57d7255e04fbab8e784bc9edbd5b0d90091e92d3041/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a65616e6c726e742f6c61726176656c2d63616e63656c6c61626c65)](https://packagist.org/packages/jeanlrnt/laravel-cancellable)

A simple package for making Laravel Eloquent models 'cancellable'. This package allows for the easy cancelling of models by creating various macros to be used within method chaining.

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

[](#installation)

This package requires PHP 7.3 or higher and Laravel 6.0 or higher.

You can install the package via composer:

```
composer require jeanlrnt/laravel-cancellable
```

Usage
-----

[](#usage)

#### Migrations

[](#migrations)

The `Cancellable` trait works similarly to Laravel's `SoftDeletes` trait. This package also ships with a helpful macro for Laravel's `\Illuminate\Database\Schema\Blueprint`. To get started, simply add the `cancelledAt` macro to your migration, like so:

```
Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('user_id');
    $table->string('title');
    $table->timestamps();
    $table->cancelledAt(); // Macro
});
```

#### Eloquent

[](#eloquent)

You can now, safely, include the `Cancellable` trait in your Eloquent model:

```
namespace App\Models;

use \Illuminate\Database\Eloquent\Model;
use \LaravelCancellable\Cancellable;

class Post extends Model {

    use Cancellable;
    ...
}
```

#### Extensions

[](#extensions)

The extensions shipped with this trait include; `cancel`, `unCancel`, `withCancelled`, `withoutCancelled`, `onlyCancelled` and can be used accordingly:

```
$user = User::first();
$user->cancel();
$user->unCancel();

$usersWithCanceled = User::query()->withCanceled();
$onlyCanceledUsers = User::query()->onlyCanceled();
```

By default, the global scope of this trait uses the `withoutCanceled` extension when the trait is added to a model.

### Testing

[](#testing)

`composer test`

### Changelog

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Joel Butcher](https://github.com/joelbutcher)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance49

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~112 days

Total

4

Last Release

972d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/957140718f095c34e5678dad5bf1c28f95ca4eafe07d7c71d81fae30a40d95ac?d=identicon)[jeanlrnt](/maintainers/jeanlrnt)

---

Top Contributors

[![jeanlrnt](https://avatars.githubusercontent.com/u/63308635?v=4)](https://github.com/jeanlrnt "jeanlrnt (10 commits)")[![joelbutcher](https://avatars.githubusercontent.com/u/7163152?v=4)](https://github.com/joelbutcher "joelbutcher (8 commits)")[![grantjanecek](https://avatars.githubusercontent.com/u/17169721?v=4)](https://github.com/grantjanecek "grantjanecek (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![cyrillkalita](https://avatars.githubusercontent.com/u/2401848?v=4)](https://github.com/cyrillkalita "cyrillkalita (1 commits)")[![Joel-Jensen](https://avatars.githubusercontent.com/u/60270137?v=4)](https://github.com/Joel-Jensen "Joel-Jensen (1 commits)")

---

Tags

cancellablecomposer-packagelaravel-packagelaravel10laravel6laravel7laravel8laravel9laravellaravel-cancellable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jeanlrnt-laravel-cancellable/health.svg)

```
[![Health](https://phpackages.com/badges/jeanlrnt-laravel-cancellable/health.svg)](https://phpackages.com/packages/jeanlrnt-laravel-cancellable)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
