PHP code example of laracademy / generators

1. Go to this page and download the library: Download laracademy/generators 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/ */

    

laracademy / generators example snippets


'blacklist' => ['migrations'];
'whitelist' => ['user_address', 'system_*'];

'filename' => fn(string $tableName) => Str::studly(Str::after($tableName, '_')),

'folder' => (function (string $tableName) {
    $prefix = Str::studly(Str::before($tableName, '_'));
    $path = app()->path('Models') . "/{$prefix}";

    if (!is_dir($path)) {
        mkdir($path);
    }

    return $path;
}),

'namespace' => fn(string $folderpath) => 'App/Models' . Str::after($folderpath, app()->path('Models')),

'delimiter' => ",\n" . str_repeat(' ', 8),

class SomeModel extends Model
{
    protected $fillable = [
        'SomeField',
        'AnotherField',
        'YetAnotherField'
    ];

php artisan

php artisan generate:modelfromtable --table=users

php artisan generate:modelfromtable --table=users,posts

php artisan generate:modelfromtable --connection=spark

php artisan generate:modelfromtable --table=user --folder=app/Models