0
0
Laravelframework~10 mins

Creating controllers with Artisan in Laravel - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Amodel
Bmigration
Ccontroller
Dseeder
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.
2fill in blank
medium

Complete 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'
AUserController
BUser
Cusercontroller
DUsers
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.
3fill in blank
hard

Fix 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'
AproductController
BProduct
Cproductcontroller
DProductController
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or camelCase names causes class not found errors.
Omitting 'Controller' suffix leads to wrong class generation.
4fill in blank
hard

Fill 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'
AOrderController
BOrder
Corder
DOrders
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or plural model names causes errors.
Omitting 'Controller' suffix in controller name is incorrect.
5fill in blank
hard

Fill 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'
ACommentController
Bresource
Capi
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--model' flag instead of '--api' causes different controller generation.
Incorrect controller name casing causes errors.