Add many status to many model with a single trait. E.g.: many status for a customer.
zoparga/laravel-model-status is a Laravel package for add many status to many model with a single trait. e.g.: many status for a customer..
It currently has 0 GitHub stars and 67 downloads on Packagist (latest version 0.8.2).
Install it with composer require zoparga/laravel-model-status.
Discover more Laravel packages by zoparga
or browse all Laravel packages to compare alternatives.
Last updated
You can install the package via composer:
composer require zoparga/laravel-model-status
You can publish and run the migrations with:
php artisan vendor:publish --provider="zoparga\ModelStatus\ModelStatusServiceProvider" --tag="model-status-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="zoparga\ModelStatus\ModelStatusServiceProvider" --tag="laravel-model-status-config"
This is the contents of the published config file:
use zoparga\ModelStatus\Traits\ModelStatuseableTrait;
class {{model}} extends Model { use ModelStatuseableTrait; }
$model = \App\Models\Model::find(1);
$model->modelStatuses()->create([
'name' => 'Default',
'order' => 1,
'is_enabled' => 1,
]);
$modelStatusId = 1;
$model->updateModelStatus($modelStatusId, [
'name' => 'Ongoing',
'order' => 2,
'is_enabled' => 0,
]);
Or you can limit it here
$model->getLatestModelStatuses()->get();
Or you can limit it here
$model->getLatestModelStatuses()->limit(3)->get();
Of course you can get last created model status
$model->getLastModelStatus();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.