At the first year of my career, many have told me that you cannot be a developer for forever. At some point, you will have to move up.
I am lucky that I did get move up, but what is an engineer’s manager, a tech lead, a VP of engineering, or a CTO? In this book, it explains their roles, expectation from the top, and from the ones they are managing of.
It helps me to understand more about these possibilities.
When I started with Laravel, nested resource group was available. I liked it because I can easily create a beautiful URL with ease. For example, to generate an URL like this/user/1/blog/10, I just need to nest my route with this:
and my controller will be
public function show(User $user, Blog $blog)
Since 5.2, this option is removed from documentation (but still available to use). So I was wondering why and I found someone already spotted this and submit a merge request. However, it was not merged with the reason below given by @taylorotwell.
OK, no problem. I will take his word for it. Since you can archieve something similar with alternative approach, e.g.
but… I still want to know why it is not a good idea? I want to find out… so I can become a better developer.
Is it because of security? This is the first thing I come of mind. Assuming the URL meant to let user store or view their own blog, e.g. user Alice with user id 1, and she has blog entries 10,11,12. Does it mean if she access URL user/1/25 will be a problem? I don’t think so given if Policy is setup properly.
The other thing I can think of is keeping the route simple. It is because if your model route key name is not its ID but a customized route key name, the URL will be very long. e.g., using the route example above, if the user model route key name is user’s name and the blog model route key name is the blog title, the route will be user/alice/blog/this-is-my-title-of-my-blog. It is definitely longer than blog/this-is-my-title-of-my-blog.
There must be some disadvantage of using nested route, what do you think it is?
In Laracon, you usually get some hard technical talks and some soft talks. I recommend to check out @bobbybouwmann if you already have at least one year of Laravel experience, @gonedark and @colindecarlo’s talk if you are quite seasonal.
My feeling is that @mijustin and @stauffermatt are the Laravel evangelists and they are the biggest cheerleaders of the Laravel community. I like how @mijustin just pour it out and reminded all of us that we only see a person’s positive side from the Internet but they could be struggling. He was reminding us that it’s OK to fail and it’s OK to share about failure. @stauffermatt reminded us that what a special community @taylorotwell has started. We must cherish this magic, continue to be proud of what we do, and continue to be a welcoming community.