Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new controller named PostController using Artisan.
Laravel
php artisan make:[1] PostController Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'model' instead of 'controller' will create a model, not a controller.
Using 'migration' or 'seeder' creates other types of files, not controllers.
✗ Incorrect
The Artisan command to create a controller is
make:controller followed by the controller name.2fill in blank
mediumComplete the command to create a resource controller named UserController.
Laravel
php artisan make:controller [1] --resource Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting 'Controller' suffix leads to incorrect class naming.
Using lowercase or plural forms is not standard for controller names.
✗ Incorrect
The controller name should include 'Controller' suffix exactly as
UserController.3fill in blank
hardFix the error in the command to create an API controller named ProductController.
Laravel
php artisan make:controller [1] --api Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or camelCase names causes class not found errors.
Omitting 'Controller' suffix leads to wrong class generation.
✗ Incorrect
The controller name must be in PascalCase and include 'Controller' suffix exactly as 'ProductController'.
4fill in blank
hardFill both blanks to create a controller named OrderController with model binding for Order.
Laravel
php artisan make:controller [1] --model=[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or plural model names causes errors.
Omitting 'Controller' suffix in controller name is incorrect.
✗ Incorrect
The controller name is 'OrderController' and the model name is 'Order' with exact casing.
5fill in blank
hardFill all three blanks to create a controller named CommentController with resource and API options.
Laravel
php artisan make:controller [1] --[2] --[3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--model' flag instead of '--api' causes different controller generation.
Incorrect controller name casing causes errors.
✗ Incorrect
The command creates 'CommentController' with both '--resource' and '--api' flags.