Do both as needed. I have in one an index method, but also an indexAdmin method.
Laravel is very flexible.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have BIG doubt . Hope someone help to clarify this .
I m really worry about the best practices of laravel 8 . Always I m trying to build up my application using laravel "resources". So Its very useful me to build up CRUD application .
Is that necessary or best practice to build up application using resource in controllers or Do i need to follow up my own custom functions in controller class
Please note : this is not Web Service. This is CRUD based Application.
Eg:
Custom Controller Functions and Routes
Route::group(['middleware' => ['auth']], function () {
Route::get('subcat/loadall', [SubCategoryController::class, 'loadDataTableData']);
Route::get('subcat/index', [SubCategoryController::class, 'index']);
Route::post('subcat/create', [SubCategoryController::class, 'create']);
Route::post('subcat/edit', [SubCategoryController::class, 'edit']);
Route::post('subcat/update', [SubCategoryController::class, 'update']);
Route::post('subcat/save', [SubCategoryController::class, 'save']);
Route::post('subcat/delete', [SubCategoryController::class, 'delete']);
});
Resources Controller Function
Route::resource('maincat', MainCategoryController::class);
It is a good practice to stick with resource, so that the url, route name, action and method follows general convention. https://laravel.com/docs/8.x/controllers#actions-handled-by-resource-controller
So, if you are working in a team, everyone can easily work and understand (Rather then having different route names and method to remember)
But, sometimes you might also want to use custom routes and there is nothing wrong about it.
Please or to participate in this conversation.