PHPackages                             uutkukorkmaz/laravel-statuses - 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. uutkukorkmaz/laravel-statuses

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

uutkukorkmaz/laravel-statuses
=============================

A package that makes managing the model statuses easier

v0.1.1(2y ago)0726MITPHPPHP ^8.1

Since Nov 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/uutkukorkmaz/laravel-statuses)[ Packagist](https://packagist.org/packages/uutkukorkmaz/laravel-statuses)[ Docs](https://github.com/uutkukorkmaz/laravel-statuses)[ RSS](/packages/uutkukorkmaz-laravel-statuses/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (12)Versions (4)Used By (0)

[![Laravel Statuses](https://github.com/uutkukorkmaz/laravel-statuses/raw/main/.github/package-banner.png)](https://github.com/uutkukorkmaz/laravel-statuses/raw/main/.github/package-banner.png)

Laravel Statuses
================

[](#laravel-statuses)

[![Latest Version on Packagist](https://camo.githubusercontent.com/954ec6c2bf86dd9165b8550264f5fe2ca4fd5a75775c5f7e5f04dd995ed30113/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7575746b756b6f726b6d617a2f6c61726176656c2d73746174757365732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/uutkukorkmaz/laravel-statuses)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2f95602f57096475cc5d57ca5d0184ea0e589aa0d9b03e69524b978213f38ff7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7575746b756b6f726b6d617a2f6c61726176656c2d73746174757365732f72756e2d74657374732e796d6c3f6c6162656c3d7465737473266272616e63683d6d61696e)](https://github.com/uutkukorkmaz/laravel-statuses/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3c77e1335d04ce2f33255333b00a2b536d8179f9e06832c2818ad21c5a776e1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7575746b756b6f726b6d617a2f6c61726176656c2d73746174757365732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6c6162656c3d636f64652532307374796c65266272616e63683d6d61696e)](https://github.com/uutkukorkmaz/laravel-statuses/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/000d6cebe7dc1a8029fe7b2d135d2cdbdf65d8298ed7caea111674905e02ea51/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7575746b756b6f726b6d617a2f6c61726176656c2d73746174757365732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/uutkukorkmaz/laravel-statuses)

Laravel Statuses is a package that makes managing the model statuses easier. It provides a trait that you can use in your models to add statuses to them.

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

[](#installation)

You can install the package via composer:

```
composer require uutkukorkmaz/laravel-statuses
```

You can publish the config file with:

```
php artisan vendor:publish --tag="statuses-config"
```

This is the contents of the published config file:

```
return [

    'namespace' => 'Enums\\Statuses',

    'allow_sequential' => true,

];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To create a new status, you can use the `status:generate` command. This will generate an `Enum` in your project's `app/Enums` directory.

```
php artisan status:generate OrderStatus
```

### Defining Cases

[](#defining-cases)

You can define cases for your status by adding constants to your `Enum` class. The name of the constant will be used as the case name, and the value will be used as the case value.

```
php artisan status:generate OrderStatus --cases Pending,Approved,Processing,Shipped,Delivered
```

The result of the above command will be:

```
