hnhdigital-os / laravel-model-traits by bluora

Provides a collection of useful traits for Laravel Eloquent models.
Package Data
Maintainer Username: bluora
Maintainer Contact: (Rocco Howard)
Package Create Date: 2016-06-15
Package Last Update: 2018-10-21
Language: PHP
License: MIT
Last Refreshed: 2024-02-25 15:11:56
Package Statistics
Total Downloads: 108
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 7
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Laravel Model Traits Collection

Provides a collection of useful traits for Laravel Eloquent models.

This package has been developed by H&H|Digital, an Australian botique developer. Visit us at


Via composer:

$ composer require hnhdigital-os/laravel-model-traits ~1.0


Model saving

Add or save a model with model based attribute rules.

use Bluora\LarvelModelTraits\ModelValidationTrait;

class User extends Model
    use ModelValidationTrait;


Model events

Automatically call an event for created and updated on a model.

use Bluora\LarvelModelTraits\ModelEventsTrait;

class User extends Model
    use ModelEventsTrait;




  • Model default ordering
  • Relation based ordering
  • Supports raw input.
use Bluora\LarvelModelTraits\OrderByTrait;

class User extends Model
    use OrderByTrait;

    protected $default_order_by = 'name';
    protected $default_order_direction = 'asc';
$model->order('FIELD(status,3,2,1)', 'desc');
$model->order('other_model.status', 'desc');

Model state (Active, Archived, Deleted) Support

Adds support for functions relating to the state of a model provided by the Eloquent ORM.

The feature is exposed through a trait by casting your UUID columns as uuid.

use Bluora\LarvelModelTraits\ModelStateTrait;

class User extends Model
    use ModelStateTrait;



Please see CONTRIBUTING for details.



The MIT License (MIT). Please see License File for more information.