for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use jeremykenedy\laravel2step\App\Models\TwoStepAuth;
class CreateTwoStepAuthTable extends Migration
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
$twoStepAuth = new TwoStepAuth();
$connection = $twoStepAuth->getConnectionName();
$table = $twoStepAuth->getTableName();
$tableCheck = Schema::connection($connection)->hasTable($table);
if (! $tableCheck) {
Schema::connection($connection)->create($table, function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('userId')->unsigned()->index();
$table->foreign('userId')->references('id')->on('users')->onDelete('cascade');
$table->string('authCode')->nullable();
$table->integer('authCount');
$table->boolean('authStatus')->default(false);
$table->dateTime('authDate')->nullable();
$table->dateTime('requestDate')->nullable();
$table->timestamps();
});
}
* Reverse the migrations.
public function down()
Schema::connection($connection)->dropIfExists($table);
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.