PHPackages                             adamcmoore/laravel-approvable - 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. adamcmoore/laravel-approvable

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

adamcmoore/laravel-approvable
=============================

Require approval of changes to eloquent models

v2.1(2y ago)3151[1 issues](https://github.com/adamcmoore/laravel-approvable/issues)[1 PRs](https://github.com/adamcmoore/laravel-approvable/pulls)MITPHPPHP ^8.1

Since Aug 16Pushed 2y ago2 watchersCompare

[ Source](https://github.com/adamcmoore/laravel-approvable)[ Packagist](https://packagist.org/packages/adamcmoore/laravel-approvable)[ RSS](/packages/adamcmoore-laravel-approvable/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (7)Versions (14)Used By (0)

Laravel Approvable
------------------

[](#laravel-approvable)

A package to require the approval of changes to Eloquent Models.

Supports Laravel version 10.

### Setup

[](#setup)

#### Require Package

[](#require-package)

`composer require adamcmoore/laravel-approvable`

#### Publish &amp; run migrations

[](#publish--run-migrations)

`php artisan vendor:publish --provider "AcMoore\Approvable\ApprovableServiceProvider" --tag="migrations"``php artisan migrate`

#### Set models requiring approval

[](#set-models-requiring-approval)

```
use AcMoore\Approvable\Approvable;
use AcMoore\Approvable\ApprovableContract;

class Article extends Model implements ApprovableContract
{
    use Approvable;

    // Only fields set as approvable will be used when considering
    // if a new version is required, and only these fields will be
    // stored in the new version. If this isn't set, the $fillable
    // fields are used.
    public $approvable = [
        'title',
        'content',
    ];

    // Optionally set a datetime field on the model to be set with
    // the date that the draft was first approved.
    protected $timestamp_field_for_first_approved = 'approved_at';

}

```

#### Setup related models requiring approval

[](#setup-related-models-requiring-approval)

```
use AcMoore\Approvable\Approvable;
use AcMoore\Approvable\ApprovableContract;

class ArticleImage extends Model implements ApprovableContract
{
    use Approvable;

    public $approvable = [
        'file_url',
    ];

    // Set the name of the parent relation.
    // Currently only belongsTo has been tested
    public $approvable_parent = 'article';

    public function article()
    {
        return $this->belongsTo(Article::class);
    }
}

```

### Usage example

[](#usage-example)

```
$article = Article::find(1)->get();
$article->title = 'New Title';

Article::enableApproval();
$article->save();
Article::disableApproval();

```

...

```
$article = $article->has('draft')->with('versions')->first();

// The version with a status of draft, rejected, or approved
$draft = $article->draft;

// An Article model with the draft values filled
$preview = $article->draft->preview;

// Set status of version as approved. Version remains as a draft.
$draft->approve('Optional note regarding decision to approve');

// Set status of version as rejected. Version is removed as a draft.
$draft->reject('Optional note regarding decision to reject');

// Write the draft to the database object
$draft->apply('Optional note regarding decision to apply');

// Ignore the draft
$draft->drop('Optional note regarding decision to drop');

```

### Force draft creation when updating

[](#force-draft-creation-when-updating)

Creating and Deleting will always create a draft when approval is enabled.

Updating will only create a draft when model attributes have been changed.

To always taking a draft, even when no data has been changed, use `Model::forceDraft();` after `Model::enableApproval()`.

### Eloquent Model Events

[](#eloquent-model-events)

Model events are fired on the Approvable Model when the status of its draft changes. These can be listened to with an Observer. Events triggered are:

- `new_draft`
- `approved`
- `rejected`
- `dropped`
- `applied`

### Todo

[](#todo)

- Add support for creating &amp; deleting non-relation records
- Test &amp; support for other types of relations, other than belongsTo

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% of commits — single point of failure

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 ~213 days

Recently: every ~109 days

Total

10

Last Release

949d ago

Major Versions

v0.4 → v1.02020-12-09

v1.0.4 → v2.02023-05-02

PHP version history (3 changes)v0.1PHP &gt;=7.0.13

v1.0PHP &gt;=7.3

v2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbab38a8b9f83883889deadfa1c407c2282a9f6d80175f1c5633abca9d2bf402?d=identicon)[adamcmoore](/maintainers/adamcmoore)

---

Top Contributors

[![adamcmoore](https://avatars.githubusercontent.com/u/5844678?v=4)](https://github.com/adamcmoore "adamcmoore (40 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adamcmoore-laravel-approvable/health.svg)

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20432.2M1.5k](/packages/illuminate-queue)[prettus/l5-repository

Laravel 8|9|10|11|12|13 - Repositories to the database layer

4.2k11.2M153](/packages/prettus-l5-repository)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

438834.4k1](/packages/clickbar-laravel-magellan)[laragear/populate

Populate your database with a supercharged, continuable seeder

8713.1k](/packages/laragear-populate)[altek/accountant

The auditing &amp; accountability package for Laravel's Eloquent ORM.

92995.1k4](/packages/altek-accountant)

PHPackages © 2026

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