malekbenelouafi/laravel-status
Composer 安装命令:
composer require malekbenelouafi/laravel-status
包简介
Laravel status a simple, automatic Status check for any model based on Laravel.
README 文档
README
A simple, automatic Status check for any model based on Laravel 4.* - 5.*
What are the benefits?
You can check the status of any module with sample way.
Installation
To get started, require this package
- Via Composer
composer require malekbenelouafi/laravel-status
- Via composer.json file
Add the following to the require section of your projects composer.json file.
"malekbenelouafi/laravel-status": "1.*",
Run composer update to download the package
composer update
Usage
Migrations
When using the migration you should add new columnstatus.
$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.
Simply, the schema seems something like this.
Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->tinyInteger('status')->comment('0: inactive; 1: active'); .... .... $table->timestamps(); });
Models
Use this trait in any model.
To set up a model to using Uuid, simply use the HasStatus trait:
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:
ExampleModel::withInactive(): to get all element together ( all )ExampleModel::withoutInactive(): to get items Without inactive element ( only active ) => by defaultExampleModel::onlyInactive(): to get only inactive element
Support
If you are having general issues with this package, feel free to contact me malekbelouafi@gmail.com.
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.
If you're using this package, I'd love to hear your thoughts. Thanks!
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 65
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-08