laravel - Find out how this route transfers values
PHP中文网
PHP中文网 2017-05-16 16:50:21
0
1
324

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中文网

认证0级讲师

reply all(1)
为情所困

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/...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!