-
Which command is used to create a migration file in Laravel with a specific table name and columns?
A)
php artisan make:migration create_table_name --fields=name:string,age:integer
B)
php artisan make:migration create_table_name --table=name,age
C)
php artisan make:migration create_table_name --create=table_name
D)
php artisan make:migration create_table_name --schema=name:string,age:integer
Answer: D)
php artisan make:migration create_table_name --schema=name:string,age:integer
-
What is the purpose of Laravel's
php artisan route:clear
command?A) To clear the application cache
B) To clear the route cache
C) To clear the configuration cache
D) To clear the session data
Answer: B) To clear the route cache
-
Which of the following statements is true about Laravel's events and listeners?
A) Events are responsible for handling HTTP requests
B) Listeners are responsible for defining database schema
C) Events are triggered by listeners
D) Listeners are triggered by events
Answer: D) Listeners are triggered by events
-
What is the purpose of Laravel's
php artisan make:provider
command?A) To create a new middleware provider
B) To create a new service provider
C) To create a new event provider
D) To create a new authentication provider
Answer: B) To create a new service provider
-
In Laravel, which of the following relationships defines a one-to-many relationship?
A)
belongsTo()
B)
hasOne()
C)
hasMany()
D)
belongsToMany()
Answer: C)
hasMany()
-
What is the purpose of Laravel's
php artisan make:factory
command?A) To create a new model factory
B) To create a new database migration
C) To create a new controller factory
D) To create a new middleware factory
Answer: A) To create a new model factory
-
Which of the following is NOT a valid HTTP method in Laravel's routing system?
A) PATCH
B) DELETE
C) REDIRECT
D) OPTIONS
Answer: C) REDIRECT
-
What is the purpose of Laravel's
php artisan tinker
command?A) To run tests for the application
B) To interact with the application's code in an interactive shell
C) To optimize the application's performance
D) To generate API documentation
Answer: B) To interact with the application's code in an interactive shell
-
Which of the following is NOT a valid method to define a route prefix in Laravel?
A)
Route::prefix('admin')
B)
Route::group(['prefix' => 'admin'])
C)
Route::setPrefix('admin')
D)
Route::namespace('admin')
Answer: C)
Route::setPrefix('admin')
-
What is the purpose of Laravel's
php artisan make:job
command?A) To create a new model job
B) To create a new database migration job
C) To create a new controller job
D) To create a new queueable job
Answer: D) To create a new queueable job
Comments