Getting Started

  1. Generator Commands
  2. Generator Inputs

Generator Commands

Generator provides various commands to generate scaffold & apis.

php artisan infyom:api $MODEL_NAME
php artisan infyom:scaffold $MODEL_NAME
php artisan infyom:api_scaffold $MODEL_NAME 

Generator Inputs

It is really important how to use generator.

Generator supports three methods of input:

We will discuss console method here. You can check other options from above links.

When you run command, it give following instructions,

Specify fields for the model (skip id & timestamp fields, we will add it automatically)
(Read docs carefully to specify field inputs)
Enter "exit" to finish 

Here, you have to insert fields for you models, except id & timestamps (created_at & updated_at) fields. That will be automatically added by generator. When you are done with inserting fields. Type "exit".

When you run any command, it asks for two things:

  1. Field Inputs
  2. Validations

Field Inputs

Now, let's get started with specifying the field. There is some format in which we have to specify field inputs

name db_type html_type options

Here is what this means,
  • name - name of the field (snake_case recommended)
  • db_type - database type. e.g.
    • string - $table->string('field_name')
    • string,25 - $table->string('field_name', 25)
    • text - $table->text('field_name')
    • integer,false,true - $table->integer('field_name',false,true)
    • string:unique - $table->string('field_name')->unique()
    • For foreign keys,
      • integer:unsigned:foreign,table_name,id
      • $table->foreign('field_name')->references('id')->on('table_name')
  • html_type - html field type for forms. e.g.
    • text
    • textarea
    • password

    Here is the full guide for field inputs

  • options - Options to prevent field from being searchable, fillable, display in form & index

    Here are all options by which you can prevent it, these all fields should be passed by comma separated string.

    e.g. s,f,if,ii

    • s - specify to make field non-searchable
    • f - specify to make field non-fillable
    • if - to skip field from being asked in form
    • ii - to skip field from being displayed in index view

so here are some examples, how field inputs can be passed together

  • title string text
  • body text textarea s,ii
  • email string:unique email
  • writer_id integer:unsigned:foreign,writers,id text s


In second field you can specify validations for fields from any available validations of laravel.


  • required
  • min:5
  • email
  • numeric

Generator also supports various other commands to generate files individually like generating an only model, repository or controller etc. You can find a full doc here.