Laravel-Gii Visual code generation tool CRUD + GUI

sunshinev發表於2019-12-13

It is suitable for rapid B-side background development, and generates corresponding Model, Observer, Controller, View, Route and other related project files according to the MySQL table structure.

中文文件
image

[TOC]

Installation

Expansion Pack

Composer require sunshinev/laravel-gii -vvv

Post

This operation will publish assets static files to the public directory

php artisan vendor: publish

select
Tag: laravel-gii

Visit

http: [domain]/gii/model

Instructions

Generate Model

Form description

  1. Table name (support drop-down selection)
  2. Model class name (want to create model classes, including namespaces)
  3. Parent class of model inheritance (If it is Mongo, it can inherit Jenssegers \ Mongodb \ Eloquent \ Model, MySQL usesIlluminate \ Database \ Eloquent \ Model)

The generated file list, blue represents a new file, red represents an existing file but different, and white represents an existing file.

07656dfd51458bb03cb50825aef4fbc01576222008.jpg

Generate CRUD

The creation of CRUD depends on the previously created model.

This operation will also generate:

  • route
  • controller
  • views

Form description

  1. Controller name (including namespace)
  2. The model class created earlier

85bce766f1a574d97ac931c8b98c29591576222771.jpg

Features

MySQL list loading

Pull list from configured MySQL database
135efc4b0abc7a7baf67793fb8de30901576222494.jpg

File comparison

The tool will compare the newly generated file with the existing file, which is convenient for viewing the modified part and controlling the scope of the modification.

image

Route Append

Newly generated pages are automatically appended to the routing configuration file
b58eb0bd955bafea27540d6227e611731576209355.jpg

CRUD background effects

List

Includes comprehensive additions, deletions, and changes

  • List
  • Pagination
  • Retrieve
  • Delete + batch delete
  • Preview
  • Details
  • Edit

a7124e651545e7f462e898ffb37704a41576223115.jpg

delete + batch delete

Cancel button zoom in to prevent accidental deletion

fa926f38e95888fd4a3c3aa055d202f41576223165.jpg

Row Preview

0b2b1603c043aec9b5cee84a17e26f291576223207.jpg

Edit page

bc43b30f13de17e0a2a899a59f647d3a1576223248.jpg

Suggest

What if you want to use Mongo?

If the Model is generated, the connection configured in the env will be used by default. If you need to adjust, you need to modify the generated Model file.

    // if connection is empty, use default connection
    protected $ connection = '';

How do background pages support other components?

The background page uniformly uses iview as the front-end framework. Currently, all components of iview4 are supported. You can add components directly to the generated blade template file.

iviewuidocument

How to upgrade the iview component of the page?

The generated CRUD background is based on laravel-fe-render and [base-fe](https://github.com/sunshinev/base -fe) Two projects, of which base-fe is a package of Vue + iview, as follows:

import Vue from 'vue'
import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
Vue.use (ViewUI);

You can Fork the base-fe project, and then upgrade the iview. Place the generated dist directory in theassets directory of the laravel-fe-render project, and then republish it.

Relevant information

https://github.com/sunshinev/laravel-fe-re...

https://github.com/sunshinev/base-fe

https://github.com/sunshinev/laravel-gii

相關文章