ycs77 / laravel-crud-page
This package is abandoned and no longer maintained.
No replacement package was suggested.
Fast generate CRUD pages, controllers of the Laravel.
v1.0.1
2019-05-30 14:01 UTC
Requires
- kabbouchi/laravel-table-view: ^0.1.15
- kris/laravel-form-builder: ^1.20
- ycs77/laravel-form-builder-bs4: ^1.0
- ycs77/laravel-form-field-type: ^1.3
Requires (Dev)
- orchestra/testbench: ^3.8
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2020-04-30 00:56:52 UTC
README
Fast generate CRUD pages, controllers of the Laravel.
This package is for
users
to use, NOTadministrator
.
- The form builder uses packages Laravel form builder and Laravel form field type, config use Laravel form builder BS4.
- The table builder uses kabbouchi/laravel-table-view
- This package the icon uses Fontawesome 5's icon, requires manual installation.
Installation
Via Composer:
composer require ycs77/laravel-crud-page
Publish config (Required):
php artisan vendor:publish --tag=laravel-crud-page
php artisan vendor:publish --tag=laravel-form-builder-bs4
php artisan vendor:publish --tag=laravel-form-field-type-config
Usage
Config
Add your resource to config:
config/crud-page.php
'resources' => [ // ... 'post' => [ 'model' => '\App\Post', 'controller' => '\App\Http\Controllers\PostController', 'file_store' => 'posts', 'view_name' => null, 'actions' => [ 'index' => true, 'create' => true, 'show' => true, 'edit' => true, 'delete' => true, ], ], ],
Controller
Create controller:
php artisan make:crud:controller PostController
Created a new CRUD controller:
class PostController extends CrudController { /** * Get table fields. * * @see https://github.com/KABBOUCHI/laravel-table-view#usage * * @return array */ protected function getTableFields() { return [ 'Title' => 'title', ]; } /** * Get form fields. * * @see https://github.com/ycs77/laravel-form-field-type * * @return array */ protected function formFields() { return [ 'title' => [ 'type' => 'text', 'rules' => 'required|max:50', ], 'content' => [ 'type' => 'textarea', 'rules' => 'required', ], 'submit', ]; } }
Routes
Add resources routes (resource post
is example):
config/crud-page.php
CrudPage::routes('post');
View
If you want override view, can create view to views folder posts/index
. (posts
is resource name, index
is action).