PHP code example of dev-lnk / laravel-code-builder

1. Go to this page and download the library: Download dev-lnk/laravel-code-builder 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/ */

    

dev-lnk / laravel-code-builder example snippets


Schema::create('products', function (Blueprint $table) {
    $table->id();
    $table->string('title')->default('Default');
    $table->text('content');
    $table->foreignIdFor(User::class)
        ->nullable()
        ->constrained()
        ->nullOnDelete()
        ->cascadeOnUpdate();
    $table->smallInteger('sort_number')->default(0);
    $table->boolean('is_active')->default(0);
    $table->timestamps();
    $table->softDeletes();
});


return [
    'builders' => [
        'model',
//        'addAction',
//        'editAction',
//        'request',
//        'controller',
//        'route',
        'form',
//        'DTO',
//        'table',
    ],
    //...
];
shell
php artisan vendor:publish --tag=laravel-code-builder
shell
php artisan code:build User
shell
app/Generation/Models/User.php was created successfully!
...
shell
php artisan code:build user --model --request
shell
php artisan code:build user --builders --request