php artisan infyom:api $MODEL_NAME
php artisan infyom:scaffold $MODEL_NAME
php artisan infyom:api_scaffold $MODEL_NAME
php artisan infyom:scaffold $MODEL_NAME --fieldsFile=file.json
-
- limit: Limit the number of returned results
- search: Global search on all searchable fields
- offset: Offset from where results should be returned
- sortedBy: Sort result by given field
Test cases for your APIs will be also generated when test generation option is true which is a default value in config. You can make it false, if you do not want to generate it.
'add_on.tests' => false
-
#Pagination php artisan infyom:api $MODEL_NAME --paginate=10 # Datatables php artisan infyom:scaffold $MODEL_NAME --datatables=true # Views php artisan infyom:scaffold $MODEL_NAME --views=index,create,edit,show # Save schema in json for future php artisan infyom:scaffold $MODEL_NAME --save
From file
{
"name": "title",
"dbType": "string,50",
"htmlType": "text",
"validations": "required",
"searchable": true,
"fillable": true,
"primary": false,
"inForm": true,
"inIndex": true
}
Relation from file
{
"name": "writer_id",
"dbType": "integer:unsigned:foreign,writers,id",
"htmlType": "text",
"relation": "mt1,Writer,writer_id,id"
}
Other relation like one to many
{
"type": "relation",
"relation": "1tm,Comment,post_id"
}
Custom tale name
php artisan infyom:scaffold $MODEL_NAME --tableName=custom_table_name
From table
php artisan infyom:scaffold $MODEL_NAME --fromTable --tableName=$TABLE_NAME
Skip File Generation
php artisan infyom:api_scaffold Post --skip=routes,migration,model
prefix like auth/admin/
php artisan infyom:scaffold $MODEL_NAME --prefix=admin
Supported HTML Input Types & Formats Valid Examples
text | text |
---|---|
textarea | textarea |
date | date |
number | number |
password | password |
file | file |
select | |
select | value1,value2,value3 |
select | label1:value1,label2:value2,label3:value3 |
select | Daily,Weekly,Monthly |
select | Sunday:0,Monday:1,Tuesday:2 |
checkbox | |
checkbox | value checkbox |
checkbox | yes |
checkbox | 1 |
radio | |
radio | label1,label2 |
radio | label1:value1,label2:value2 |
radio | Male,Female |
radio | Yes:1,No:0 |
toggle | switch toggle-switch |
Relationship Type | Valid Examples |
---|---|
One to One | 1t1,Phone |
1t1 | Phone,user_id |
1t1 | Phone,user_id,id |
One to Many | 1tm,Comment |
1tm | Comment,post_id |
1tm | Comment,post_id,id |
Many to One | mt1,Post |
mt1 | Post,post_id |
Many to Many | mtm,Role |
mtm | Role,user_roles |
mtm | Role,user_roles,user_id,role_id |