Edu
Hub
Courses
AI Tools
Leaderboard
Login/Register
AR
Abdullah Rashid
abdullah@example.com
Navigation
📚
Courses
🏆
Leaderboard
✨
AI Tools
←
Laravel Intermediate Quiz
⏱
15:00
Quit
0 / 20 answered
0%
Laravel Intermediate Quiz
10 questions · Medium difficulty · 00:20:00 min
🔥 In Progress
Question 1
Which Laravel method is used to define a route that responds to both GET and POST requests?
Route::any('/', ...)
Route::match(['get', 'post'], '/', ...)
Route::post('/', ...)
Route::get('/', ...)
Question 2
What is the purpose of the 'php artisan migrate:rollback' command?
Rolls back the last migration operation
Deletes all database tables
Runs pending migrations
Creates a fresh migration file
Question 3
Which middleware is automatically applied to all web routes in Laravel by default?
StartSession
auth
api
web
Question 4
In Eloquent, which method is used to define a many-to-many relationship?
hasOne()
belongsTo()
belongsToMany()
hasMany()
Question 5
What does the 'php artisan make:model Post -m' command do?
Creates a model and a migration file
Creates a model and a seeder
Creates a controller and a model
Creates a migration and a seeder
Question 6
Which Blade directive is used to include a sub-view?
@section
@extends
@component
@include
Question 7
What is the default queue connection configured in Laravel's config/queue.php?
sync
redis
null
database
Question 8
Which method is used to validate incoming request data in a controller?
validate()
confirm()
check()
sanitize()
Question 9
How do you retrieve the currently authenticated user in Laravel?
auth()->user()
request()->user()
Auth::check()
Session::get('user')
Question 10
Which Laravel feature allows you to write expressive and fluent database queries using PHP syntax?
Eloquent ORM
Schema Builder
Database Migrations
Query Builder
Question 11
What is the purpose of the 'php artisan tinker' command?
Runs database seeds
Clears application cache
Provides an interactive REPL for Laravel
Compiles Blade templates
Question 12
Which facade is used to generate URLs in Laravel?
Response
Route
URL
Redirect
Question 13
In Laravel, what does the 'php artisan storage:link' command create?
A database storage engine
A cached storage directory
A symbolic link from public/storage to storage/app/public
A new storage disk configuration
Question 14
Which method is used to define an accessor in an Eloquent model?
get{Attribute}Attribute
fillable
mutator
set{Attribute}Attribute
Question 15
What is the role of service providers in Laravel?
They manage database connections
They handle HTTP requests and responses
They are the central bootstrapping for all Laravel services
They define routes for the application
Question 16
Which Blade directive is used to define a layout section that can be overridden by child views?
@section
@yield
@include
@extends
Question 17
How do you pass data to all views in a Laravel application?
Using Route::param()
Using config('app.data')
Using View::share() in a service provider
Using Session::flash()
Question 18
Which Laravel method is used to abort a request with a custom HTTP response?
halt()
stop()
die()
abort()
Question 19
What does the 'php artisan route:list' command do?
Caches the route definitions
Displays all registered routes
Generates a new route file
Tests all routes for errors
Question 20
Which of the following is a valid way to define a middleware that runs on every request?
Add it to the route group middleware property
Register it in the 'middleware' array in app/Http/Kernel.php
Use the 'middleware' method in a controller constructor
Set it in the .env file
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →