我想对我的 Laravel URL 进行 SEO,所以我想更改www.example.com/posts/32
为www.example.com/posts/how-to-name-routes
我看到我可以通过在路由上链接name()
方法来手动命名路由,但我希望name
从帖子的标题中自动填充。然而,标题包含空格所以我的Post
对象会有,title
'How to name routes'
但 URL 会是www.example.com/posts/how-to-name-routes
我需要实现我自己的字符串操作系统还是 Laravel 已经处理了?
芜湖不芜
月关宝盒