Laravel Status
, (*1)
A simple, automatic Status check for any model based on Laravel 4.* - 5.*, (*2)
What are the benefits?
You can check the status of any module with sample way., (*3)
Installation
To get started, require this package, (*4)
``` bash
composer require malekbenelouafi/laravel-status, (*5)
- Via composer.json file
Add the following to the `require` section of your projects `composer.json` file.
``` php
"malekbenelouafi/laravel-status": "1.*",
Run composer update to download the package, (*6)
``` bash
composer update, (*7)
## Usage
#### Migrations
When using the migration you should add new column`status`.
``` php
$table->tinyInteger('status')->comment('0: inactive; 1: active');
it's will create column status name inside of our database schema, To be ready to receive check the model., (*8)
Simply, the schema seems something like this., (*9)
``` php
Schema::create('users', function (Blueprint $table) {, (*10)
$table->increments('id');
$table->tinyInteger('status')->comment('0: inactive; 1: active');
....
....
$table->timestamps();
});, (*11)
#### Models
Use this trait in any model.
To set up a model to using Uuid, simply use the HasStatus trait:
``` php
use Illuminate\Database\Eloquent\Model;
use Malekbenelouafi\LaravelStatus\HasStatus;
class ExampleModel extends Model
{
use HasStatus;
....
}
Controller
When you create a new instance of a model which uses Status, our package will automatically by deafult get only active items also you can uses this scope methods:, (*12)
-
ExampleModel::withInactive()
: to get all element together ( all )
-
ExampleModel::withoutInactive()
: to get items Without inactive element ( only active ) => by default
-
ExampleModel::onlyInactive()
: to get only inactive element
Support
If you are having general issues with this package, feel free to contact me malekbelouafi@gmail.com., (*13)
If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request., (*14)
If you're using this package, I'd love to hear your thoughts. Thanks!, (*15)
License
The MIT License (MIT). Please see License File for more information., (*16)