angelrove / crud-core
dev-master
2022-05-03 14:00 UTC
Requires
- angelrove/cms-components: dev-master
- intervention/image: ^2.5
- laravelcollective/html: ^6.2
- prologue/alerts: ^1.0
- yajra/laravel-datatables-oracle: ^9.0
This package is auto-updated.
Last update: 2024-09-30 01:32:29 UTC
README
Laravel 中创建管理面板的基本 CRUD 组件和工具。(使用 Laravel Collective)[laravelcollective.com]
安装
composer require angelrove/crud-core
php artisan vendor:publish --tag crudcore
在 'composer.json' 中注册服务提供者
"post-package-update": [
"@php artisan vendor:publish --tag crudcore --force"
]
服务
- EventStatus:用于会话控制
- JsLoad
组件
- DbTables
- FormInputs
- Backpack:视图和资源
使用方法
```php
class FundingsController extends Controller
{
public function __construct()
{
CrudCore::init();
...
}
...
}
```
EventStatus
```php
$componentId = 'fundings';
// Filters
$f_country = EventStatus::getData($componentId, 'f_location');
$f_search = EventStatus::getData($componentId, 'search');
```
DbTables
轻松创建自定义、可编辑的表格。
```php
$columns = [
(new DtColumn('id', 'Id'))->sortable(),
(new DtColumn('created_at', 'created at'))->type('datetime'),
(new DtColumn('name', 'Organization'))->sortable(),
(new DtColumn('announced_date', 'Announced date'))->type('date'),
(new DtColumn('money_raised', 'Money raised $'))->align('right')->type('money_short'),
(new DtColumn('total_amount', 'Total $'))->align('right')->type('money'),
];
$dbTable = new DbTables($componentId, Funding::select(), $columns);
$dbTable->showNew();
$dbTable->showUpdate();
{!! $dataTable->get() !!}
```
DataTables
从 PHP 创建 DataTable 组件(https://datatables.net.cn/)
FormInputs
表单组件是帮助您解决允许最终用户与应用程序中的数据进行交互和修改数据问题的工具。
FormInputs::password();
FormInputs::text();
FormInputs::textarea();
FormInputs::hidden();
FormInputs::select();
FormInputs::radios();
FormInputs::check();
FormInputs::file();
FormInputs::email();
FormInputs::number();
FormInputs::price();
FormInputs::percent();
FormInputs::datetime();
FormInputs::date();
FormInputs::month();
FormInputs::week();
FormInputs::time();
FormInputs::url();
FormInputs::tel();
FormInputs::autocomplete();
Backpack:视图和资源
提供了两种视图
blank-secc
@extends('CrudCore::blank-secc') @section('content') {!! $tableUsers->get() !!} @stopblank-edit
查看:https://laravelcollective.com/docs/6.x/html#form-model-binding
```php
@extends('CrudCore::blank-edit')
@section('form')
{!! Form::model($data, [
'route' => [$route, $data->id],
'method' => $method,
'files' => $files,
]) !!}
<x-crudcore.input name="name" />
<x-crudcore.input name="email" type="email" required />
<?=FormInputs::price('money_raised', $data->money_raised)->title('Money raised')->required()->container()->get() ?>
@stop
```