I just read the Laravel news post about the Url::defaults method.
The article doesn't mention it has a caveat, that can cause a model binding problem.
Why would you use global middleware to make it easier to get a route in blade in the first place?
A less invasive way to solve this is to create a helper.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
And use it in views where it makes sense.
The above is the detailed content of My thoughts on the Url::defaults method. For more information, please follow other related articles on the PHP Chinese website!