
Laravel 9 route group with controller
Laravel 9 route group with controller
In this session, we are going to try to solve the "Laravel 9 route group with controller" puzzle by using the computer language.
You can group all the routes which utilize the same controller using controller method in Laravel 9.-
Route grouping with controller
--PATH routes\web.phpuse App\Http\Controllers\OrderController; Route::controller(OrderController::class)->group(function () { Route::get('/orders/{id}', 'show'); Route::post('/orders', 'store'); });
If a group of routes uses the same controller then you can group all the routes using the controller method.
Additional Note:
1. Create OrderController using php artisan command - php artisan make:controller OrderController
2. Import/use controller in routes/web.php using use App\Http\Controllers\OrderController;
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- Laravel csrf token mismatch for ajax POST Request
- How to get the id of last record from collection object in laravel view
- Create project factory and seed data in laravel
- Laravel API response format
- Get today records in Laravel
- SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'posts_user_id_foreign'; check that column/key exists
- How to decrypt laravel password
- How to customize pagination view in laravel
- How to fetch single row data from database in laravel
- How to check relationship is loaded or not in Laravel
- OrderBy on Eloquent relationships method in Laravel
- How to Access Array in blade laravel
- Cannot end a section without first starting one
- How to display HTML tags In Laravel blade
- How to upload local Laravel project to server ?
- How to get path from current URL in Laravel
- Get only 10 records from table in laravel
- How to get file extension from input type file in laravel
- If condition in foreach loop in laravel
- Laravel get all records with pagination
- Split an Eloquent Collection by half in Laravel
- Create a record if not exist in laravel
- How to create pivot table in laravel using migration
- How to upload image in laravel 8
- FirstOrCreate() Not Inserting Model