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

[11.x] Resource Route Paths #53190

Closed
wants to merge 2 commits into from

Conversation

amdad121
Copy link
Contributor

We often use Route::resource in our projects to generate seven standard routes with a single command, simplifying the process:

index (GET /resource)
create (GET /resource/create)
store (POST /resource)
show (GET /resource/{id})
edit (GET /resource/{id}/edit)
update (PUT/PATCH /resource/{id})
destroy (DELETE /resource/{id})

This setup works well, but sometimes we need to customize paths for create and edit actions, like using "add" instead of "create" for medicines.

Now, we can customize these paths using:

Route::resource('users', UserController::class)->paths([
    'create' => 'add',
    'edit' => 'change',
]);

This makes our routes more intuitive based on the resource context.

Screenshot 2024-10-16 at 11 22 14 PM

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

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