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] Allow enums to be passed to routes #52561

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

NickSdot
Copy link
Contributor

Like a lot of developers, I hate strings. Strings are for users.

Enums give me type safety for speling mistakes, and generally make me feel more comfortable about the world and my code.

This PR brings the router methods name and domain into line with implicit route binding, Eloquent, AssertableJson, etc...

This change is backward compatible.

// before
Route::domain(InterfaceDomain::Marketing->value)->name(Routes::Home->value)->get('/contact', ContactController::class);

// after
Route::domain(InterfaceDomain::Marketing)->name(Routes::Home)->get('/'contact, ContactController::class);

@taylorotwell taylorotwell merged commit b543d69 into laravel:11.x Aug 23, 2024
29 checks passed
@NickSdot NickSdot deleted the backed-route-enums branch August 23, 2024 16:34
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