search

Home  >  Q&A  >  body text

php - Today when I was learning laravel, I saw a problem with the foreign key constraints on the document.

1. First I generated three tables

< /p>

< /p>

article_tag is associated with the article table and tags table respectively

2. Then I conducted some code testing

$article = \App\Article::destroy(21);
dd($article);

In my mind, when I delete the data in the articles table, the 21 data corresponding to the article_tag table in the third table will also be deleted, but the actual situation is not deleted

I want to know where I made the wrong picture description

PHP中文网PHP中文网2864 days ago340

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-16 13:04:27

    Laravel Eloquent does not have automatic cascade deletion function

    reply
    0
  • Cancelreply