Level 8
remove this: $table->increments('user_id'); it should generate automatically increments if you not disabled in your model.
Why would I be getting Fatal error: Call to undefined method CreateUsers::increments() When I run php artisan migrate
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('user_id');
$table->string('f_name');
$table->string('l_name');
$table->string('gender');
$table->date('dob');
$table->string('company_name');
$table->string('email')->unique();
$table->string('password');
$table->increments('landline');
$table->increments('mobile');
$table->increments('activated');
$this->increments('social_login');
$table->timestamp('last_login');
$table->rememberToken();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
Schema::create('users', function (Blueprint $table) {
$table->increments('user_id');
$table->string('f_name');
$table->string('l_name');
$table->string('gender');
$table->date('dob');
$table->string('company_name');
$table->string('email')->unique();
$table->string('password');
$table->increments('landline');
$table->increments('mobile');
$table->increments('activated');
$this->increments('social_login'); // <<<< HERE you are referring to $this, not $table
$table->timestamp('last_login');
$table->rememberToken();
});
As an aside, you appear to be using increments inappropriately - in fact, Laravel probably cannot handle this. Try the following:
$table->string('landline');
$table->string('mobile');
$table->boolean('activated');
$table->string('social_login');.Please or to participate in this conversation.