laravel / ideas

Issues board used for Laravel internals discussions.
939 stars 28 forks source link

add optional scaffolding parameter to stubs #2455

Open alexmilde opened 3 years ago

alexmilde commented 3 years ago

First of all: thank you so much for laravel. been using the framework for almost ten years and love it.

tl;dr do you think adding something like optional {{ $scaffolding }} to vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/migration.create.stub could be a good idea?

        Schema::create('{{ table }}', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            {{ $scaffolding }}
        });

I plan to write an addon which improves table creation for "often needed tables" E.g. i'm pretty shure im not the only user who needs a migration which creates an "opengraphs" table, holding all the fields from ogp.me laravel package.

something like: php artisan make:migration-scaffolded opengraphs with:path/to/configfile (configfile holds information what fields to add to the migration stub)

creates something like:

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->string('description');
    $table->string('type');
    $table->string('url');
    $table->timestamps();
});

of course im willing to add this myself, but before i start - i wanted to check how you feel about this.

having this single line im pretty shure i could do the rest in a package extending MigrationCreator.php

as im pretty new to OSS and not the best in describing my ideas: please let me know if you need more information about my idea.

best & thanks! alex