amamarul/boiler-plate-commands
Composer 安装命令:
composer require amamarul/boiler-plate-commands
包简介
Package to generate automatic cruds for Laravel BoilerPlate Apps
关键字:
README 文档
README
Package to generate automatic cruds for Laravel BoilerPlate Apps [Laravel 5 Boilerplate]
The amamarul:crud make:
1 - Model
2 - Model Trait Attribute
3 - Model Trait Relationship
4 - Model Trait Scope
5 - Form Request
6 - Controller
7 - Datatable as Service for Controller
8 - Routes
9 - Breadcrumbs
Install Boilerplate
$ git clone https://github.com/rappasoft/laravel-5-boilerplate.git
$ cd laravel-5-boilerplate
$ composer install
Duplicate .env.example and rename to .env
$ php artisan key:generate
Set Database in .env
Install Package (Laravel)
Via Composer
$ composer require amamarul/boiler-plate-commands
Require Datatables Package
$ composer require yajra/laravel-datatables-buttons:^1.1
Service Provider
Yajra\Datatables\ButtonsServiceProvider::class
Configuration and Assets
$ php artisan vendor:publish --tag=datatables-buttons
Add the following to the AppServiceProvider in the register function:
app/Providers/AppServiceProvider.php
/* * Load third party local providers */ $this->app->register(\Amamarul\BoilerPlateCommands\Providers\BoilerPlateCommandsServiceProvider::class);
The register function should look like this
public function register() { /* * Sets third party service providers that are only needed on local/testing environments */ if ($this->app->environment() == 'local' || $this->app->environment() == 'testing') { /** * Loader for registering facades. */ $loader = \Illuminate\Foundation\AliasLoader::getInstance(); /* * Load third party local providers */ $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class); /* * Load third party local aliases */ $loader->alias('Debugbar', \Barryvdh\Debugbar\Facade::class); /* * Load third party local providers */ $this->app->register(\Amamarul\BoilerPlateCommands\Providers\BoilerPlateCommandsServiceProvider::class); } }
Publish the views
$ php artisan vendor:publish --provider='Amamarul\BoilerPlateCommands\Providers\BoilerPlateCommandsServiceProvider'
Usage
You need the tables migrated
create migration
$ php artisan make:migration create_products_table
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateProductsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('products', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('products'); } }
Migrate
$ php artisan migrate
Make the Crud
Run the following commands
amamarul:crud {name} {tabla} {seccion} {grupo?}
* name: Is the Model Name
* tabla: Is the table name
* seccion: can be 'Backend', 'Frontend' or the section you want
* grupo: if you want to group different Models and Controllers like sub sections. this is optional
This is an example for Backend and the group 'Products'. Then you can to add another model/controller in that group
$ php artisan amamarul:crud Product products Backend Products
- The result in console will be
Model created successfully. Request created successfully. TraitAttribute created successfully. TraitRelationship created successfully. TraitScope created successfully. Controller created successfully. DataTable created successfully. Routes created successfully. Breadcrumbs created successfully.
- Run php artisan serve
$ php artisan serve
Now you can go to http://localhost:8000/admin/products/product and you will show the datatable.
Go to app/Http/Controllers/Backend/Products/DataTables/ProductDataTable.php and uncomment the fields you want to show in the datatable in the getColumns() function (the last function), by default you will see only 'id', 'created_at' and 'updated_at'.
Contributing
Contributions are welcome and will be fully credited.
I accept contributions via Pull Requests
Credits
License
The MIT License (MIT). Please see License File for more information.
amamarul/boiler-plate-commands 适用场景与选型建议
amamarul/boiler-plate-commands 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.64k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2017 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「boilerplate」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amamarul/boiler-plate-commands 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amamarul/boiler-plate-commands 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amamarul/boiler-plate-commands 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP class to extend when building a WordPress plugin allowing you to follow smart plugin setup standards.
Anax htmlform module.
Laravel 5.7 Boilerplate based on Bootstrap 4 and Tabler for Backend.
WordPress Plugin Framework
Simple ASCII output of array data
统计信息
- 总下载量: 1.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-09