PHPackages                             seriousjelly/laravel-draftable - 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. seriousjelly/laravel-draftable

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

seriousjelly/laravel-draftable
==============================

A Eloquent Draftable trait for Laravel

22854PHP

Since Mar 16Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-Draftable
=================

[](#laravel-draftable)

Easily add status to your models in Laravel 5.

[![Latest Stable Version](https://camo.githubusercontent.com/03c832b984a041885089eed52ce8b36809c9532a701d66dcb5e70d68de1dd29c/68747470733a2f2f706f7365722e707567782e6f72672f736572696f75736a656c6c792f6c61726176656c2d647261667461626c652f762f737461626c65)](https://packagist.org/packages/seriousjelly/laravel-draftable)[![Total Downloads](https://camo.githubusercontent.com/00800faa3b4a073ed3cf00f901eec587184c4a5e2a8e11666760d6b2caf1adc9/68747470733a2f2f706f7365722e707567782e6f72672f736572696f75736a656c6c792f6c61726176656c2d647261667461626c652f646f776e6c6f616473)](https://packagist.org/packages/seriousjelly/laravel-draftable)[![Latest Unstable Version](https://camo.githubusercontent.com/12c9205dac8d7497195866380baafca7b22a29722f724adc311ae281f8a0e35d/68747470733a2f2f706f7365722e707567782e6f72672f736572696f75736a656c6c792f6c61726176656c2d647261667461626c652f762f756e737461626c65)](https://packagist.org/packages/seriousjelly/laravel-draftable)[![License](https://camo.githubusercontent.com/e0d8fcfa3d5de7d311ce04ac7a4080303e08ac5c0659e2cd19282dcd07f67635/68747470733a2f2f706f7365722e707567782e6f72672f736572696f75736a656c6c792f6c61726176656c2d647261667461626c652f6c6963656e7365)](https://packagist.org/packages/seriousjelly/laravel-draftable)

- [Installation and Requirements](#installation)
- [Updating your Eloquent Models](#eloquent)
- [Usage](#usage)
- [Still To Do](#todo)
- [Copyright and License](#copyright)

Installation and Requirements
-----------------------------

[](#installation-and-requirements)

1. Install the `seriousjelly/laravel-draftable` package via composer:

    ```
    $ composer require seriousjelly/laravel-draftable
    ```
2. Add the service provider (`config/app.php` for Laravel 5):

    ```
    # Add the service provider to the `providers` array
    'providers' => array(
        ...
        'Seriousjelly\Draftable\ServiceProvider',
    )
    ```
3. Ensure that your migrations contain a `status` column by copy &amp; pasting the below into your table migration file:

    ```
    # Add a status column to the table, feel free to change the default value.
    $table->boolean('status')->default(0);
    ```

Updating your Eloquent Models
-----------------------------

[](#updating-your-eloquent-models)

Your models should use Draftable's trait:

```
use Seriousjelly\Draftable\DraftableTrait;

class MyModel extends Model
{
    use Draftable;
}
```

Your model is now draftable!

Using this trait
----------------

[](#using-this-trait)

By default all records that have a status of 0 will be excluded from your query results. To include draft records, all you need to do is call the `withDrafts()` method on your query.

```
// Returns only live data
Posts::get();

//Returns live & draft data
Posts::withDrafts()->get();
```

Still To Do
-----------

[](#still-to-do)

- Add onlyDrafts() method.
- Add artisan command to create `status` column on a table you choose (i.e `php artisan draftable:table table_name`.
- Allow the user to specify the column name in this package config (currently hardcoded to status).

Copyright and License
---------------------

[](#copyright-and-license)

Laravel-Draftable was written by Chris Bratherton and released under the MIT License. See the LICENSE file for details.

Copyright 2015 Chris Bratherton

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

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

---

Tags

eloquentlaraveltrait

### Embed Badge

![Health badge](/badges/seriousjelly-laravel-draftable/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M542](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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