Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4] Allow routes to be registered fluently #16647

Merged
merged 6 commits into from
Dec 6, 2016

Conversation

JosephSilber
Copy link
Member

@JosephSilber JosephSilber commented Dec 4, 2016

This enables stuff like:

Route::name('users.index')->middleware('auth')->get('users', function () {
    // some closure action...
});

...so that the calls to name and middleware are not hanging off the end of the closure.


Also, you can now use the middleware method with groups:

Route::middleware('auth')->prefix('api')->group(function () {
    // register some routes...
});

Finally, you can now register middleware for resources directly:

Route::middleware('auth')->resource('photo', 'PhotoController');

P.S. This has been previously attempted in #14354. Taking another stab at it here after talking it through with Taylor.

@taylorotwell taylorotwell merged commit 680b4d1 into laravel:master Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants