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
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class PushNotificationDevices extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
Schema::create('push_notification_devices', function (Blueprint $table) {
$table->increments('id');
$table->string('device_token');
$table->integer('user_id');
$table->text('access_token')->nullable();
$table->unique(array('device_token', 'user_id'));
$table->softDeletes();
$table->timestamps();
});
}
* Reverse the migrations.
public function down()
Schema::dropIfExists('push_notifications_devices');