PHP code example of coresuit / migration-gen-laravel

1. Go to this page and download the library: Download coresuit/migration-gen-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

coresuit / migration-gen-laravel example snippets


Route::prefix('pedido')->controller(PedidoController::class)->group(function () {
    Route::get('/', 'index');
    Route::get('{id}', 'show')->whereNumber('id');
    Route::post('/', 'store');
    Route::put('{id}', 'update')->whereNumber('id');
    Route::delete('{id}', 'destroy')->whereNumber('id');
    Route::post('{id}/restore', 'restore')->whereNumber('id');
    Route::delete('{id}/force', 'forceDelete')->whereNumber('id');
});
bash
php artisan coresuit:make-migration init
bash
composer package:discover --ansi
php artisan l5-swagger:generate
# A doc padrão fica em /api/documentation
bash
php artisan coresuit:make-entity \
  --name=Pedido \
  --fields="cliente_id:int:true,data_pedido:date:true,observacao:text:false,valor_total:decimal:true,ativo:boolean:false"
bash
php artisan migrate

app/
  DTOs/Shared/IndexQueryDTO.php
  Http/
    Controllers/
      Shared/BaseController.php
      System/<Entity>Controller.php
    Requests/
      Shared/{BaseIndexRequest,IndexRequest}.php
      <Entity>/{<Entity>ListRequest,<Entity>StoreRequest,<Entity>UpdateRequest}.php
  Models/<Entity>.php
  OpenApi/OpenApi.php
  Providers/{RepositoryServiceProvider,ServicesServiceProvider}.php
  Repositories/
    Contracts/{IBaseRepository.php,I<Entity>Repository.php}
    <Entity>/<Entity>Repository.php
  Services/
    Shared/{BaseService.php,IBaseService.php}
    <Entity>/{I<Entity>Service.php,<Entity>Service.php}

routes/api.php     # contém // [router_marckenew_generates]
bootstrap/cache/coresuit_init.flag
bash
php artisan list | grep coresuit
php artisan help coresuit:make-entity
bash
   php artisan coresuit:make-migration init
   
bash
   php artisan vendor:publish --tag=coresuit-stubs
   # edite em stubs/coresuit/*.stub