laravel make controller and model code example

Example 1: laravel create controller

php artisan make:controller MyController

Example 2: create model with controller laravel

php artisan make:controller CustomersController --model=Customer

Example 3: laravel route controller

use App\Http\Controllers\UserController;

Route::get('user/{id}', [UserController::class, 'show']);

Example 4: create model with controller laravel

php artisan make:model Customer
php artisan make:controller CustomersController --resource

Example 5: laravel create resource controller

php artisan make:controller PhotoController --resource --model=Photo

Example 6: how to create resource controller in laravel

Resource Controller:This controller will create all CRUD methods
php artisan make:controller nameOfController --resource