duke/crud-generator

Laravel CRUD Generator

dev-master 2019-11-16 09:25 UTC

README

__# Laravel CRUD Generator

Build Status Total Downloads Latest Stable Version License

This Generator package provides various generators like CRUD, API, Controller, Model, Migration, View for your painless development of your applications.

Requirements

Laravel >= 5.3
PHP >= 5.6.4

Installation

composer require duke/crud-generator --dev
php artisan vendor:publish --provider="Duke\CrudGenerator\CrudGeneratorServiceProvider"

'aliases' => [
    ...
    'Excel' => Duke\CrudGenerator\Facades\Excel::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": "integer#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="/path/to/fields.json" --view-path=admin --controller-namespace=Admin --route-group=admin --form-helper=html