承接 timwassenburg/default-model-order 相关项目开发

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

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

timwassenburg/default-model-order

最新稳定版本:v1.0.1

Composer 安装命令:

composer require timwassenburg/default-model-order

包简介

Adds a trait to make your models sortable

README 文档

README

Logo

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

Features

This simple package adds a trait to your project that can be used to sort collections of a model by default by a specified column. As a result, the model looks more clean and readable.

Installation

Install the package with composer.

composer require timwassenburg/default-model-order

Usage

Once you have installed the package, you can import the DefaultOrder trait into your model to set the default order. Then, you can assign the desired column to the $orderBy variable to order by that column. Additionally, you may optionally set the $orderDirection variable to specify the direction of the order, with the default value being asc.

use TimWassenburg\DefaultModelOrder\DefaultOrder;

class User extends Model
{
    use DefaultOrder;

    protected static string $orderBy = 'name';
    protected static string $orderDirection = 'desc';
}

Publish config (optional)

Suppose you wish to modify the default column name or direction. In that case, you may publish the configuration file to make the necessary adjustments. To do so, run the following command:

php artisan vendor:publish --provider="TimWassenburg\DefaultModelOrder\DefaultModelOrderServiceProvider" --tag="config"

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固