lundi 8 février 2016

Laravel 5.2 - Laravel Model With Migration with able Name Command

I have 2 commands for making migration and making model.

If I run-

php artisan make:migration create_users_table --create=temps

Then I am getting a migration like this- 2016_02_09_060158_create_users_table.php

And content inside this file is -

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('temps', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('temps');
    }
}

If I run this command-

php artisan make:model User -m

Then I am getting this 2 files-

2016_02_09_060436_create_temps_table.php

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTempsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('temps', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('temps');
    }
}

Temp.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Temp extends Model
{
    //
}

But I want to have a command which is a mixture of this 2 s that I can get 2 file and DB name should be included in the files (say in this case table name is temps).

Is there any way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire