Answer the question
In order to leave comments, you need to log in
Laravel routes, what's the syntax for (uses ..., as ...)?
https://github.com/developerdino/example-articles-...
Route::get(
'articles/{article}/relationships/author',
[
'uses' => \App\Http\Controllers\ArticleRelationshipController::class . '@author',
'as' => 'articles.relationships.author',
]
);
Answer the question
In order to leave comments, you need to log in
uses is a callback, that is, what will be executed when your path pattern matches the path in the browser, translated as "use", in the example the controller method is used
as -- the name of the route, so that later it can be accessed from view for example and get the path
judging by this piece - there are a lot of routes and they are connected by common sections, so you can combine them into groups and namespaces and thereby improve the readability of the code!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question