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.7] Make PendingResourceRegistration macroable #25947

Merged
merged 2 commits into from Oct 5, 2018

Conversation

Projects
None yet
2 participants
@freekmurze
Contributor

freekmurze commented Oct 5, 2018

By making PendingResourceRegistration macroable users can define their own helper methods when registering routes.

Here's an example of a macro definition

PendingResourceRegistration::macro('can', function(string $permission) {
   $this->middleware("can:{$permission}");
});

and it's usage:

Route::resource('users', UsersController::class)->can('administerUsers');

freekmurze added some commits Oct 5, 2018

@taylorotwell taylorotwell merged commit 5e11178 into laravel:5.7 Oct 5, 2018

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@GrahamCampbell GrahamCampbell changed the title from Make PendingResourceRegistration macroable to [5.7] Make PendingResourceRegistration macroable Oct 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment