jeudi 18 février 2016

Best place to write Insert Scripts in Schema Builder file

I am using below code to create the table using Schema Builder.

Schema::create('tblCategory', function (Blueprint $table) {
    $table->increments('CategoryID');
    $table->string('Category', 40);
    $table->unique('Category', 'tblCategory_UK_Category');
    $table->timestamps();
});

Question: Is it recommended to write Insert Scripts in the same class ?

Something like

Schema::create('tblCategory', function (Blueprint $table) {
        $table->increments('CategoryID');
        $table->string('Category', 40);
        $table->unique('Category', 'tblCategory_UK_Category');
        $table->timestamps();
    });
Insert into tblCategory(Category)Values('Engineering');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire