我有两种资源,砖块和墙壁。class Brick extends Model public function walls() return $this->belongsToMany('App\Wall')->withTimestamps();}class Wall extends Model public function bricks() return $this->hasMany('App\Brick'
当我执行下面的SQL代码来创建数据库和表时,我得到了错误消息:Error Code: 1215. Cannot add foreign key constraint。如果我将test.book.storeID设置为主键,则代码可以工作。引用的列需要是主键吗?USE `test` ;
`ID` INT UNSIGNED NOT NULL,
`storeID` INT UNS