定制 wcr/crud 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固