در حال بارگذاری ...

Fluent Route Definitions0:00

Next up, we have some fluent updates to the routing interface. So in the past, if you wanted to, for example, apply a name to a given route, you would do it like so. Or further, maybe if you wanted to apply a group, you would call the group method, you'd then prefix any namespace that you want, and then reference your closure here, and this is where all of your other routes would be located, right? So nothing wrong with that, but you can now use more of a fluent interface for defining your routes. For example, rather than specifying the name at the end, if you want, you could say route name home, and then get this route. And further, things like prefix can also be called fluently. So I could say I want to apply a prefix of API, and then I want the following group. Pretty cool. Or further, you could apply middleware. So I could say, so for example, maybe we have a dashboard, and we want to apply a middleware to it. Well,

Adding Prefix and Middleware0:44

the following group. Pretty cool. Or further, you could apply middleware. So I could say, so for example, maybe we have a dashboard, and we want to apply a middleware to it. Well, of course, you could do that within the controller, or if you want, you could apply it right here. Middleware, and we want to apply the auth middleware. Like so. Okay, that's all there is to this one.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟