PHPackages                             ggmm-one/model-helpers-for-laravel - 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. ggmm-one/model-helpers-for-laravel

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

ggmm-one/model-helpers-for-laravel
==================================

A set of helpers for building Laravel apps even faster

v1.6.0(5y ago)015MITPHPCI failing

Since Apr 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ggmm-one/model-helpers-for-laravel)[ Packagist](https://packagist.org/packages/ggmm-one/model-helpers-for-laravel)[ RSS](/packages/ggmm-one-model-helpers-for-laravel/feed)WikiDiscussions master Synced today

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

Model Helpers for Laravel
=========================

[](#model-helpers-for-laravel)

A set of helpers for building Laravel apps even faster:

- [CascadeSoftDeletes](cascadesofdeletes) - emulates sql cascade on delete for SoftDelete models
- [HasModelDisplayName](hasmodeldisplaynames) - used by other helpers to figure out the display name
- [HasOrder](hasorder) - creates a default order by scope

CascadeSoftDeletes
------------------

[](#cascadesoftdeletes)

If you have a class like:

```
class User extends Model
{
    use SoftDeletes;

    public function posts()
    {
        return $this->hasMany('App\Posts');
    }
}
```

You can modify to:

```
use Ggmm\Model\CascadeSoftDeletes;

class User extends Model
{
    use CascadeSoftDeletes;

    protected $cascadeDelete = ['posts'];

    public function posts()
    {
        return $this->hasMany('App\Posts');
    }
}
```

Now every time you soft delete a user, all of its posts will also be deleted.

Some notes:

- It's a good idea to wrap the delete call in a transaction;
- All models to be cascade delete must use SoftDelete or CascadeSoftDelete;
- If you forceDelete, there will be no cascading. Use standard DB functionality for that;
- It doesn't do cascade restore. But since all models are saved with the same deleted\_at time you can query the database and restore those items based on the deleted\_at value. (will be done in next version)

HasModelDisplayName
-------------------

[](#hasmodeldisplayname)

Adds the getModelDisplayName() function.

The default name is the class name. Example: class "ArticlePost"; display name "Article Post".

You can override the name by using a variable named modelDisplayName.

```
class ArticlePost
{
    protected $modelDisplayName = 'Magazine Post';
}
```

HasOrder
--------

[](#hasorder)

Creates a scope that orders by based on what you have set on a variable called hasOrder.

```
use Ggmm\Model\HasOrder;

class Post extends Model {
    use HasOrder;

    protected $hasOrder = ['created_at' => 'desc', 'title'];
}

//You can then do things like
Post::ordered()->get();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~48 days

Recently: every ~59 days

Total

6

Last Release

2016d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/846074?v=4)[ggmm](/maintainers/ggmm)[@ggmm](https://github.com/ggmm)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![ggmm-one](https://avatars.githubusercontent.com/u/55441732?v=4)](https://github.com/ggmm-one "ggmm-one (1 commits)")

---

Tags

laravellibrarypackagephp

### Embed Badge

![Health badge](/badges/ggmm-one-model-helpers-for-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/ggmm-one-model-helpers-for-laravel/health.svg)](https://phpackages.com/packages/ggmm-one-model-helpers-for-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-settings

Store your application settings

1.5k7.3M143](/packages/spatie-laravel-settings)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

198321.1k](/packages/fumeapp-modeltyper)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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