for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
<?php
namespace CosmicRadioTV\Podcast\Updates;
use DB;
use Illuminate\Database\Schema\Blueprint;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateShowsTable extends Migration
{
/**
* Migration
*/
public function up()
DB::transaction(function () {
Schema::create('cosmicradiotv_podcast_shows', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name');
$table->string('slug');
$table->text('description')->nullable();
$table->timestamps();
$table->unique('slug');
});
}
* Rollback
public function down()
Schema::drop('cosmicradiotv_podcast_shows');