search

Home  >  Q&A  >  body text

laravel - Find out how this route transfers values

In the route, a variable {posts} is passed in. The variable name must be like this. If it is not changed to something else, it will be wrong.

Run to the corresponding controller why this post became a Post model

Specific code
https://github.com/Vuedo/vued...

https://github.com/Vuedo/vued...

PHP中文网PHP中文网2843 days ago402

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-16 16:52:21

    That’s 路由-模型绑定. To put it simply, Laravel first uses the id you passed in to find such a record in the database, then instantiates it into the corresponding model and then injects it into the controller.

    Documentation: https://laravel.com/docs/5.3/...

    reply
    0
  • Cancelreply