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 deal with Route::resource()? #73

Open
gpluess opened this issue Aug 25, 2022 · 1 comment
Open

How to deal with Route::resource()? #73

gpluess opened this issue Aug 25, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@gpluess
Copy link

gpluess commented Aug 25, 2022

What's the best way to deal with Resource Controllers?

Since there is no Route::multilingualResource() at the moment, I've solved it like this.

Before:

Route::resource('companies', \App\Http\Controllers\CompanyController::class)

After:

Route::multilingual('companies', [\App\Http\Controllers\CompanyController::class, 'index'])->name('companies.index');
Route::multilingual('companies/create', [\App\Http\Controllers\CompanyController::class, 'create'])->name('companies.create');
Route::multilingual('companies/{company}', [\App\Http\Controllers\CompanyController::class, 'show'])->name('companies.show');
Route::multilingual('companies/{company}/edit', [\App\Http\Controllers\CompanyController::class, 'edit'])->name('companies.edit');

Route::resource('companies', \App\Http\Controllers\CompanyController::class)->only([
    'store', 'update', 'destroy'
]);

Is there a better way to solve this?

@chinleung
Copy link
Owner

Hey @gpluess,

I've missed the notification for this issue for some reasons. 🙈 There's no methods for resource controller at the moment but I'll definitely accept a pull request for this. 😄

@chinleung chinleung added the enhancement New feature or request label Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants