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

How to disable same routes? #7

Closed
xnf4o opened this issue Sep 25, 2020 · 2 comments
Closed

How to disable same routes? #7

xnf4o opened this issue Sep 25, 2020 · 2 comments
Labels
FAQ Frequently asked questions

Comments

@xnf4o
Copy link

xnf4o commented Sep 25, 2020

As example i had to disable any BATCH routes for some reason. How can i make this?

@alexzarbn alexzarbn added the FAQ Frequently asked questions label Sep 27, 2020
@alexzarbn
Copy link
Member

alexzarbn commented Sep 27, 2020

Hi @xnf4o,

When you register a route, it returns an instance of Laravel's PendingResourceRegistration class.
You can use ->except method to disable specific routes.

In your case:

Orion::resource('posts', 'API\PostsController')->except(['batchStore', 'batchUpdate', 'batchDestroy']);

However, I will look into providing an additional method (something like ->withoutBatch()) that would disable all batch routes at once.

@alexzarbn
Copy link
Member

alexzarbn commented Oct 15, 2020

It is now possible to disable all batch routes at once using ->withoutBatch method on a resource.
Documentation has been updated with relevant information.

// example usage
Orion::resource('posts', 'API\PostsController')->withoutBatch();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ Frequently asked questions
Projects
None yet
Development

No branches or pull requests

2 participants