duke/crud-generator

laravel crud-generator

dev-master 2020-03-25 22:15 UTC

This package is auto-updated.

Last update: 2020-08-25 22:23:52 UTC


README

__# Laravel CRUD Generator

Total Downloads License

Installation

composer require duke/crud-generator
!!! Warning !!!
Если у вас есть css/app.css нужно переименовать его
php artisan vendor:publish --provider="Duke\CrudGenerator\CrudGeneratorServiceProvider" --force


in    app\Http\Kernel

protected $routeMiddleware = [
    ...
    'admin' => \App\Http\Middleware\isAdmin::class,
    'date' => \App\Http\Middleware\Date::class,
]

Promo prject

php artisan promo:project

Usage

CRUD fields from a JSON file:

{
    "fields": [
        {
            "name": "title",
            "type": "string"
        },
        {
            "name": "content",
            "type": "text"
        },
        {
            "name": "category",
            "type": "select",
            "options": {
                "technology": "Technology",
                "tips": "Tips",
                "health": "Health"
            }
        },
        {
            "name": "user_id",
            "type": "bigint#unsigned"
        }
    ],
    "foreign_keys": [
        {
            "column": "user_id",
            "references": "id",
            "on": "users",
            "onDelete": "cascade"
        }
    ],
    "relationships": [
        {
            "name": "user",
            "type": "belongsTo",
            "class": "App\\User"
        }
    ],
    "validations": [
        {
            "field": "title",
            "rules": "required|max:10"
        }
    ]
}
php artisan crud:generate Posts --fields_from_file="duke/j.json" --view-path=admin --controller-namespace=Admin --route-group=admin --form-helper=html

"# duke"