duke/crud-generator

Laravel CRUD Generator

1.0.0 2020-01-21 15:44 UTC

This package is auto-updated.

Last update: 2020-01-22 08:18:51 UTC


README

__# Laravel CRUD Generator

Build Status Total Downloads Latest Stable Version 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,
]

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"