Learn Laravel MCQs
Prepare Laravel MCQs (Multiple choice Questions) for exam and job interviews.
What is the command to reset all migrations in Laravel?
1) php artisan migrate:reset
2) php artisan migrate:refresh
3) php artisan migrate:rollback
4) php artisan migrate:drop
Answer : php artisan migrate:reset
How can you create a new test case in Laravel?
1) php artisan make:test
2) artisan create:test
3) make:test
4) create:test
Answer : php artisan make:test
What is the purpose of the `php artisan route:clear` command?
1) Clear the route cache
2) Clear application cache
3) Clear view cache
4) Clear config cache
Answer : Clear the route cache
How do you create a new route in Laravel?
1) Route::get()
2) Route::create()
3) php artisan make:route
4) create:route
Answer : Route::get()
What is the purpose of the `app/Exceptions` directory in Laravel?
1) Store custom exceptions
2) Store controllers
3) Store middleware
4) Store routes
Answer : Store custom exceptions
How do you send a notification in Laravel?
1) Notification::send()
2) sendNotification()
3) Mail::to()
4) notification()
Answer : Notification::send()
What is the command to create a new command bus in Laravel?
1) php artisan make:command
2) artisan create:command
3) make:command
4) create:command
Answer : php artisan make:command
How can you add a custom validation rule in Laravel?
1) Validator::extend()
2) addRule()
3) validate()
4) customValidation()
Answer : Validator::extend()
What is the purpose of the `resources/lang` directory?
1) Store localization files
2) Store configuration files
3) Store views
4) Store controllers
Answer : Store localization files
How do you generate a new model factory in Laravel?
1) php artisan make:factory
2) artisan create:factory
3) make:factory
4) create:factory
Answer : php artisan make:factory