wcr/crud
Composer 安装命令:
composer require wcr/crud
包简介
a package for crud
README 文档
README
Laravel crud package. The views are optimized for https://github.com/jeroennoten/Laravel-AdminLTE
Required
Laravel 5.5 https://laravel.com/docs/5.5
Former https://github.com/formers/former
Install
Download package and setting
$ composer require wcr/crud
$ php artisan vendor:publish --tag=migrations
$ php artisan migrate
$ php artisan vendor:publish --tag=abilities
We use laravel pre-built authentication
$ php artisan make:auth
Modify file: /app/User.php
<?php namespace App; use Wcr\Crud\Rolify; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use Notifiable; use Rolify; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; }
Example
Use CRUD for entity Post:
file: /app/Http/Controllers/PostController.php
<?php namespace App\Http\Controllers; use App\Post; use Wcr\Crud\Http\CrudController; class PostController extends CrudController { public $modelClass = 'App\Post'; // REQUIRED to define the model class public $acceptedAttributes = array( 'title', 'body' ); // REQUIRED to define accepted attributes by form public $validateRules = array( 'title' => 'required', 'body' => 'required' ); // OPTIONAL to define form validation }
file: /app/Post.php
<?php namespace App; use Illuminate\Database\Eloquent\Model; use Wcr\Crud\Entitize; class Post extends Model { use Entitize; }
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-02-24