wcr / entitize
为 Laravel 服务的 CRUD 包,包含 Bootstrap 和 former
0.2.3
2018-06-05 13:43 UTC
Requires
- anahkiasen/former: ^4.1@dev
- illuminate/support: ~5
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~6.0
This package is not auto-updated.
Last update: 2024-09-20 23:18:49 UTC
README
这里应该放置您的描述。请查看 contributing.md 以获取待办事项列表。
安装
通过 Composer
$ composer require wcr/entitize
用法
1. 发布组件
$ php artisan vendor:publish --tag:entitize
2. 创建带有迁移的模型
$ php artisan make:model Book -m
编辑迁移 /database/migrations/0000_00_00_000000_create_books_table.php
<?php /** more code **/ public function up() { Schema::create('books', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('autor'); $table->date('published_at')->nullable(); $table->boolean('deleted')->default(0); // This field is REQUIRED $table->timestamps(); }); } /** more code **/ ?>
启动迁移
$ php artisan migrate
3. 创建控制器
$ php artisan make:controller BookController
4. 在控制器中使用 entitize
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Wcr\Entitize\Controllers\Entitize; use App\Book; class BookController extends Controller { use Entitize; public $tableParams = ['Id'=>'id', 'Title'=>'title', 'Author'=>'author', 'Created at'=>'created_at']; public $fields = array( [ 'name' => 'title', 'label' => 'Title', 'validation' => 'required' ], [ 'name' => 'author', 'label' => 'Author', 'validation' => 'required' ], [ 'name' => 'published_at', 'label' => 'Published at', 'type' => 'date' ], ); }
变更日志
请参阅 changelog 获取最近更改的更多信息。
测试
$ composer test
贡献
请参阅 contributing.md 获取详细信息及待办事项列表。
安全
如果您发现任何安全相关的问题,请通过作者邮箱联系,而不是使用问题跟踪器。
致谢
许可证
许可证。请参阅 许可证文件 获取更多信息。