How to deal with Route::resource()?
gpluess opened this issue · 1 comments
gpluess commented
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?