Skip to content

Conversation

lindyhopchris
Copy link
Contributor

See #265

This PR adds the ability to register middleware per action, on both resource and relationship routes.

Usage for resource:

$server->resource('posts')->middleware([
    '*' => 'foo', // applied to all actions
    'show' => 'bar', // applied to just the show action
    'store' => ['baz1', 'baz2'], // use an array for multiple middleware
]);

Relationship is the same, using our short-hands for the actions:

$relationships->hasMany('tags')->middleware([
    '*' => 'foo', // applied to all
    'related' => 'bar',
    'attach' => ['baz1', 'baz2'],
]);

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.

1 participant