copain
249
5
Laravel

Auto increment integer

Posted 1 year ago by copain

i'm trying to make integer as auto increment and want to start in 100, but error keep coming up..

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and i
 t must be defined as a key

My code:

   public function up()
    {
        Schema::create('leads', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('generate_id');
            $table->string('name')->nullable();
            $table->string('office_number')->nullable();
            $table->string('father_email')->nullable();
            $table->string('father_occupation')->nullable();
            $table->string('father_religion')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('leads');
    }
}

Please sign in or create an account to participate in this conversation.