- GUI support inside the package
- Drop Down API included
- Several Bug Fixed
- Laravel 5.7 Support
- Namespace Supports
- Several Bug Fixed
-
To install Igloo Code Generator, run the following command:
composer require infancyit/igloo
-
Run the command below to load all configuration file:
php artisan vendor:publish --provider="InfancyIt\Igloo\IglooServiceProvider"
-
For allowing CORS on a API middleware group or route, add the
HandleCors
middleware tomiddleware
array in theKernel.php
file:protected $middleware = [ ... ... ... ... ... ... ... ... ... ... \Barryvdh\Cors\HandleCors::class, ];
Let's start by creating a basic Model:
Model will be saved on app\Models
folder.
Run the following command on project root.
php artisan make-model Book
If you want to add fillable
or guarded
value you may pass the list of columns as well:
php artisan make-model Book --fillable=name,author,published_date
or
php artisan make-model Book --guarded=id
or
php artisan make-model Book --fillable=name,author,published_date --guarded=id
Let's create some basic Service which will extends our BaseService from app\Services
:
Run the following command on project root.
php artisan make-service Book
Let's create some basic Repository which will extends our BaseRepository from app\Repositories
:
Run the following command on project root.
php artisan make-repository Book
Let's create a basic Transformer:
Transformer will be created in the app/Transformers/Api
folder.
Run the following command on project root.
php artisan make-transformer Book id,name,author,published_date
In the creation of Transformer
attributes
list are required. All columns should be separated by a single ,
(comma). This will create the main portion like this
public function getTransformableFields($entity)
{
return [
'id' => (int) $entity->id,
'name' => $entity->name,
'author' => $entity->author,
'published_date' => $entity->published_date
];
}
Let's create a basic Request:
Transformer will be created in the app/Request/Api
folder.
Run the following command on project root.
php artisan make-request Book id,name,author,published_date
In the creation of Request
attributes
list are required. All columns should be separated by a single ,
(comma). This will create the main portion like this
public function rules()
{
return [
'name' => 'required',
'author' => 'required',
'published_date' => 'required'
];
}
You can also create API routes for your model. Run the following command on project root.
php artisan make-route Book
This command will output like this:
///////////////////////////// Book Routes //////////////////////////////
Route::group(['prefix' => 'book', 'namespace' => 'Api'], function () {
Route::get('index', 'BookController@index')->name('book.index');
Route::post('create', 'BookController@store')->name('book.store');
Route::post('update', 'BookController@update')->name('book.update');
Route::delete('delete', 'BookController@delete')->name('book.delete');
});
This command will not save anything. You've to copy this segment from console and paste it in your web.php
or api.php
file.
The assumption for the controller name will be [Modelname]Controller.
-
For bundle create visit
-
Or you can visit
\igloo
route after package installation.
Igloo Code Generator is free software distributed under the terms of the MIT license.