承接 zoparga/laravel-model-status 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zoparga/laravel-model-status

最新稳定版本:0.8.2

Composer 安装命令:

composer require zoparga/laravel-model-status

包简介

Add many status to many model with a single trait. E.g.: many status for a customer.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

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:

Usage

  • publish migration file
  • migrate
  • add trait to model
  • use it

Prepare model

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();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

  • 总下载量: 51
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-26