Eloquent model returns 0 as primary key

前端 未结 2 920
故里飘歌
故里飘歌 2021-01-03 19:57

I have this migration:

Schema::create(\'provincias\', function (Blueprint $table) {
    $table->string(\'codigo\', 2);
    $table->string(\'nombre\', 5         


        
2条回答
  •  感动是毒
    2021-01-03 20:19

    You can try setting public $incrementing = false; on your model so eloquent doesn't expect your primary key to be an autoincrement primary key.

提交回复
热议问题