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 1mo ago

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 43% 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

1966d 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

[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)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[efureev/laravel-trees

Multi-Tree structures for Laravel

14253.3k4](/packages/efureev-laravel-trees)[illuminatech/balance

Provides support for Balance accounting system based on debit and credit principle

16137.4k](/packages/illuminatech-balance)[zonneplan/laravel-module-loader

Module loader for Laravel

24118.4k](/packages/zonneplan-laravel-module-loader)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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