
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
- Update if exist else insert new record in laravel
- The POST method is not supported for this route. Supported methods: PUT.
- How to get single column value in laravel
- How to get all posts which contains comments in laravel
- How to check record exist or not in relationship table
- Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0"
- Non-static method App\Http\Helper::myFunction() should not be called statically
- How to call controller function from view in Laravel
- Call to undefined method App\Models\User::follow()
- How to insert ckeditor data into database in Laravel?
- How to get selected categories on edit record with Select2
- Laravel get single row by id
- Target class [App\Http\Controllers\Auth\Request] does not exist.
- How to create new user without form submission in laravel
- How to print form data in laravel
- Wheredate in laravel not working
- Send id with route Laravel
- Laravel hasmany select not working
- How to customize or Change validation error messages
- Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() must be of the type string or null, object given
- SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
- Get last record from table in laravel
- Send post data from controller to view
- Get ids in array from users table
- How to create controller in laravel