2017 © Pedro Peláez
 

library laravel-sorcery

Laravel API/Scaffold/CRUD Generator from just one command with including Controller, Repository, Model, Migrations, routes.php update.

image

rohinigeeks/laravel-sorcery

Laravel API/Scaffold/CRUD Generator from just one command with including Controller, Repository, Model, Migrations, routes.php update.

  • Saturday, April 18, 2015
  • by rohinigeeks
  • Repository
  • 3 Watchers
  • 12 Stars
  • 124 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 153 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Laravel API/Scaffold/CRUD Generator (Laravel5)

Total Downloads, (*1)

Laravel Sorcery generates boilerplate code for a Laravel Web App from the MySQL Schema, (*2)

This command Generator generates following things: * Migration File * Model * Repository (optional) * Controller * View * index.blade.php * show.blade.php * create.blade.php * edit.blade.php * fields.blade.php * updates routes.php, (*3)

Here is the full documentation., (*4)

Steps to Get Started

  1. Add this package to your composer.json:, (*5)

    "require": {
        "rohinigeeks/laravel-sorcery": "dev-master"
    }
  2. Run composer update, (*6)

    composer update
  3. Add the ServiceProviders to the providers array in config/app.php.
    As we are using these two packages illuminate/html & laracasts/flash as a dependency.
    so we need to add those ServiceProviders as well., (*7)

    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Html\HtmlServiceProvider',
    'Laracasts\Flash\FlashServiceProvider'
    'Rohinigeeks\Generator\GeneratorServiceProvider'

Also for convenience, add these facades in alias array in config/app.php., (*8)

    'Form'  => 'Illuminate\Html\FormFacade',
    'HTML'  => 'Illuminate\Html\HtmlFacade',
    'Flash' => 'Laracasts\Flash\Flash'
  1. Publish generator.php, (*9)

    php artisan vendor:publish --provider='Rohinigeeks\Generator\GeneratorServiceProvider'
  2. Fire the artisan command to generate API for Model, or to generate scaffold with views for web applications, (*10)

    php artisan rohinigeeks.generator:api ModelName
    php artisan rohinigeeks.generator:scaffold ModelName

    e.g., (*11)

    php artisan rohinigeeks.generator:api Project
    php artisan rohinigeeks.generator:api Post
    
    php artisan rohinigeeks.generator:scaffold Project
    php artisan rohinigeeks.generator:scaffold Post
  3. And You are ready to go. :), (*12)

Documentation

Generator Config file

Config file (config/generator.php) contains path for all generated files, (*13)

path_migration - Path where Migration file to ge generated
path_model - Path where Model file to ge generated
path_repository - Path where Repository file to ge generated
path_controller - Path where Controller file to ge generated
path_views - Path where views will be created
path_request - Path where request file will be created
path_routes - Path of routes.php (if you are using any custom routes file)
, (*14)

namespace_model - Namespace of Model
namespace_repository - Namespace of Repository
namespace_controller - Namespace of Controller
namespace_request - Namespace for Request
, (*15)

Field Input

Here is the input for the fields by which you can specify Input., (*16)

    fieldName:fieldType,options:fieldOptions

e.g.,, (*17)

    email:string:unique
    email:string:unique,default('me@mitul.me')
    title:string,100
    price:flat,8,4

Parameters will be in the same sequence as Blueprint class function for all types. Option will be printed as it is given in input except unique & primary., (*18)

API Response Structure

Remember: This response structure is based on the most of my API response structure, you can change it to your API response after file generation in controller., (*19)

Success, (*20)

    {
        "flag":true,
        "message":"success message",
        "data":{}
    }

data can be anything as per response., (*21)

Failure, (*22)

    {
        "flag":false,
        "message":"failure message",
        "code": 0
        "data":{}
    }

data will be optional. And code will be error code., (*23)

Generated Views

While generating scaffold, all views are created with basic CRUD functionality. (currently delete is not working), (*24)

Views will be created in resources/views/modelName folder,, (*25)

    index.blade.php - Main Index file for listing records
    create.blade.php - To insert a new record
    edit.blade.php - To edit a record
    fields.blade.php - Common file of all model fields, which will be used create and edit record
    show.blade.php - To display a record

Credits

This API Generator was forked from laravel-api-generator created by 1. Jamison Valenta 2. Mitul Golakiya. 3. [Bernhard Breytenbach] (https://github.com/Xethron), (*26)

Screenshots

Command Execution

Image of Command Execution, (*27)

Generated Files & routes.php

Image of Generated Files, (*28)

Migration File

Image of Migration File, (*29)

Model File

Image of Model File, (*30)

Repository File

Image of Repository File, (*31)

Controller File

Image of Controller File, (*32)

View Files

Image of View Files, (*33)

The Versions

18/04 2015

dev-master

9999999-dev

Laravel API/Scaffold/CRUD Generator from just one command with including Controller, Repository, Model, Migrations, routes.php update.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar rohinigeeks

laravel api crud generator migration model scaffold