csgt/crud
Composer 安装命令:
composer require csgt/crud
包简介
CRUD implementation
README 文档
README
This package is used to generate cruds.
| Version | BS | Datatables | Methods | Views engine | Crypt | Constructor | UTC | Validation |
|---|---|---|---|---|---|---|---|---|
| 5.5 | 3 | 1.x | es | blade | yes | yes | no | formvaldiation |
| 5.6 | 4 | 1.x | es | blade | yes | yes | no | formvaldiation |
| 5.9 | 4 | 1.x | es | blade | yes | no | no | laravel |
| 6.0 | 4 | 1.x | en | blade | yes | yes | no | formvaldiation |
| 7.0 Beta | 4 | 1.x | en | vue | yes | yes | no | formvaldiation |
| 8.0 | 4/5 | 2.x | en | blade | no | no | yes | laravel |
Usage
To create a new CRUD, you may use the php artisan make:crud ExampleController command. This will set up a boilerplate
public function setup(Request $request)
{
//Required. Set the model to render
$this->setModel(new Model);
$this->setTitle('Title');
//This will render an extra button next to the Add button
$this->setExtraAction(['url' => '/module/import', 'title' => 'Importar']);
//Render the breadcrumb according to BS version
$this->setBreadcrumb([
['url' => '', 'title' => 'Catálogos', 'icon' => 'fa fa-book'],
['url' => '', 'title' => 'Titulo', 'icon' => 'fa fa-university'],
]);
//Set columns to show
$this->setField(['name' => 'Nombre', 'field' => 'name']);
$this->setField(['name' => 'Descripción', 'field' => 'descripcion']);
//Set combobox field
$this->setField([
'name' => 'Protocol',
'field' => 'protocol_id',
'type' => 'combobox',
'collection' => Protocol::select('id', 'name')->get(),
]);
//Campo Multi:
$this->setField(['name' => 'Requirements', 'type' => 'multi', 'field' => 'relationName']);
requiere en el modelo, crear la relation belongsToMany relationName
requiere en el modelo, crear el método fetchRelationName
opcional, si la columna para mostrar en el show, no se llama 'name'
crear el método fetchRelationNameColumn y retorne el campo deseado.
//Set hidden variables to append to inserts and updates
$this->setHidden(['field' => 'client_id', 'value' => 1]);
//Set extra button for each row in the Crud
$this->setExtraButton([
'url' => '/configuration/sensors?gateway_id={id}',
'icon' => 'fa fa-thermometer',
'title' => 'Sensors',
'class' => 'btn-warning',
]);
//Set permissions using the ['edit' => true, 'create' => true, 'delete' => true] syntax
$this->setPermissions(Cancerbero::crudPermissions('module'));
}
Upgrade from version 6 to version 8 or from 5.6 to 5.9
Add the following includes:
use Illuminate\Http\Request;
use Csgt\Cancerbero\Facades\Cancerbero;
Rename the __construct method to:
public function setup(Request $request)
Call the setPermissions directly
$this->setPermissions(Cancerbero::crudPermissions('module'));
Remove all references to Crypt::encrypt and Crypt::decrypt if any methos were overriden.
Remove all references to validationRulesMessages or reglasmensaje
Remove the enclosing middleware. It is now unnecessary.
$this->middleware(function ($request, $next) {
return $next($request);
});
csgt/crud 适用场景与选型建议
csgt/crud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.43k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 09 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 csgt/crud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 csgt/crud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-09-05