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

Merged
merged 2 commits into from
Oct 5, 2018
Merged

[5.7] Make PendingResourceRegistration macroable #25947

merged 2 commits into from
Oct 5, 2018

Conversation

freekmurze
Copy link
Contributor

@freekmurze 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');

@taylorotwell taylorotwell merged commit 5e11178 into laravel:5.7 Oct 5, 2018
@GrahamCampbell GrahamCampbell changed the title Make PendingResourceRegistration macroable [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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants