承接 elbgoods/laravel-sort-positions-rule 相关项目开发

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

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

elbgoods/laravel-sort-positions-rule

最新稳定版本:1.1.0

Composer 安装命令:

composer require elbgoods/laravel-sort-positions-rule

包简介

README 文档

README

This Package provides validation for correct sort position values for arrays.

Installation

You can install the package via composer:

composer require elbgoods/laravel-sort-positions-rule

if you want to adjust the error message translation you can add the translation files to your project:

php artisan vendor:publish --provider="Elbgoods\SortPositionsRule\SortPositionsRuleServiceProvider" --tag=lang

Usage

An example array to validate

[
    [
        'id' => 1,
        'sort_position' => 1,
        'name' => 'foo'
    ], [
        'id' => 2,
        'sort_position' => 2,
        'name' => 'bar'
    ]
];

To validate the sort position values you have to add the SortPositionsRule rule to your rule set for the whole array. You must pass in the array key for the sort position in the first parameter (sort_position in the example array). Optionally you can pass a start value in the second parameter if you don't want to start your sort position values with 1.

use Elbgoods\SortPositionsRule\Rules\SortPositionsRule;

// ...

$rules = [
    // ...
    'array_with_sortable_data' => ['array', new SortPositionsRule('sort_position', 0)],
    // ...
];

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Credits

License

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

Treeware

You're free to use this package, but if it makes it to your production environment we would highly appreciate you buying or planting the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at https://offset.earth/treeware

Read more about Treeware at https://treeware.earth

We offset our carbon footprint via Offset Earth

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-04