PHPackages                             leko-team/laravel-published - 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. leko-team/laravel-published

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

leko-team/laravel-published
===========================

Ready-made solution for publishing an entity

1.0.0(2y ago)311MITPHP

Since Oct 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/leko-team/laravel-published)[ Packagist](https://packagist.org/packages/leko-team/laravel-published)[ RSS](/packages/leko-team-laravel-published/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Associate publishing with Eloquent models
=========================================

[](#associate-publishing-with-eloquent-models)

[![Latest Version](https://camo.githubusercontent.com/760c679789621b6ba95d20ac26dfab8ce07cab16536527ec6542d7c5da431904/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6c656b6f2f6c61726176656c2d7075626c69736865642e7376673f7374796c653d666c61742d737175617265)](https://github.com/leko/laravel-published/releases)

This package can associate published date with Eloquent models. It provides a simple API to work with.

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

[](#installation)

The library can be installed via Composer:

```
composer require leko-team/laravel-published
```

Configuration
-------------

[](#configuration)

To be able publishing eloquent entities you need:

- Add migration with column `published_at` or assign `static::PUBLISHED_AT` constant with the name of the column you want to use.

```
php artisan make:migration add_published_at_column_in_`your-table`_table
```

```
Schema::table('your-table', function (Blueprint $table) {
    $table->timestamp('published_at')->nullable()->index();
});
```

If you have existing records in your table you maybe want to update them with current date. Or perhaps you want to add current date as default value.

- Add trait `PublishedTrait` to your model.

```
use PublishedTrait;
```

Examples
--------

[](#examples)

### Base

[](#base)

To publish entity:

```
$review = Review::first();
$review->publish();
```

Publish by specific datetime:

```
$review = Review::first();
$review->publish(pass here carbon entity);
```

To unpublish entity:

```
$review = Review::first();
$review->unpublish();
```

### Scopes

[](#scopes)

By default from published entity return only published records. You can change this by applying scope to your Eloquent model.

- notPublished

```
$review = Review::notPublished()->get();
```

Returns all not published record with null in `published_at` include records that must be published in the future.

- withUnpublished

```
$review = Review::withUnpublished()->get();
```

Returns all records.

- withoutPublished

```
$review = Review::withoutPublished()->get();
```

Returns all unpublished record with null in `published_at`.

Credits
-------

[](#credits)

A big thank you to [Laravel Package](https://www.laravelpackage.com/) for helping out build package with step by step guide.

License
-------

[](#license)

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

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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

Unknown

Total

1

Last Release

1040d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01feaccb615ea8e12f99549ecd0c99256cf8a3c560e12606bebffd06236da8fc?d=identicon)[leko-team](/maintainers/leko-team)

---

Top Contributors

[![FenderTr](https://avatars.githubusercontent.com/u/52920728?v=4)](https://github.com/FenderTr "FenderTr (4 commits)")[![leko-team](https://avatars.githubusercontent.com/u/16772593?v=4)](https://github.com/leko-team "leko-team (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leko-team-laravel-published/health.svg)

```
[![Health](https://phpackages.com/badges/leko-team-laravel-published/health.svg)](https://phpackages.com/packages/leko-team-laravel-published)
```

###  Alternatives

[dgr/nohup

A library to run a command in the background, it will return the process's pid, and get it's is running status anytime in the another process, and can be stoped anytime. It support Windows, Linux and Mac osx.

531.7k](/packages/dgr-nohup)

PHPackages © 2026

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