vadiasov / ordering
Laravel 包,通过 'drag and drop' 功能对数据库表的行进行排序
2.0.1
2018-03-16 14:33 UTC
Requires
- php: >=7.0
- illuminate/support: 5.*
This package is not auto-updated.
Last update: 2024-09-29 05:01:53 UTC
README
Laravel 包,通过 'drag and drop' 功能对数据库表的行进行排序。
目标
- 创建数据库表中给定行的排序并保存排序到同一表中。
- 排序是通过拖放技术实现的。
工作流程
- 父页面包含一行集合。
- 行有一个名为 'order' 的列(或具有相同意义的其他列)。
- 父页面有一个 "排序" 按钮。
- 点击 "排序" 按钮后,打开 "排序" 页面(子页面)。
- 排序制作。
- 子页面有一个 "保存并返回" 按钮。
- 点击 "保存并返回" 按钮将返回父页面。
父页面的配置
- "order" 列的列名
- 数据库表名
- 显示在子页面中的列的数组
- "保存并返回" 按钮的标题。
示例
<?php
return [
'order' => 'order',
'db_table' => 'tracks',
'fields_to_show' => ['order', 'title', 'file'],
'buton_title' => 'Save and back',
'box_title' => 'Tracks of Album ',
];
使用
父页面有一个带有 href 的 "排序" 按钮
/ordering/{config_name}
安装
1. 在应用程序根目录的 composer 中创建行
"require": {
...
"vadiasov/ordering": "^0.1.1",
...
},
2. 在您的终端中运行
cd your_application_root
composer update
3. 此包具有发现功能。因此,它必须在 config/app.com 中创建有关 ServiceProvider 的行
/*
* Package Service Providers...
*/
...
Vadiasov\Ordering\OrderingServiceProvider::class,
4. 编辑您将在外部控制器中使用的配置文件(例如:config/tracks.php)