2
我有2个表创建像这样:上的删除:级联不起作用
Schema::create('educations', function(Blueprint $table){
$table->increments('id');
$table->string('title');
$table->date('from_date');
$table->date('to_date');
$table->string('summary');
$table->integer('cv_id')->unsigned();
$table->foreign('cv_id')->references('id')
->on('cvs')
->onDelete('cascade')
->onUpdate('cascade');
$table->timestamps();
});
而且它们链接到另一个表:
Schema::create('cvs', function(Blueprint $table){
$table->increments('id');
$table->integer('student_id')->unsigned();
$table->foreign('student_id')->references('id')
->on('students')
->onDelete('cascade')
->onUpdate('cascade');
$table->string('summary');
$table->timestamps();
});
的问题是,每当我把这个线:
$student->cv->delete();
它会丢弃cv,但不会删除与其相关的表中的其他属性。
我在想什么?
你在使用SQLite吗? –
我正在使用mySQL –