All questions
Showing of 55What is Laravel and what are its key features?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Laravel is a free, open-source PHP web framework built on the Model-View-Controller (MVC) pattern. It covers routing, database access and views in one package.
Its key features:
- Eloquent ORM maps each database table to a model class for database work.
- Blade is the templating engine for views.
- Artisan is the command-line tool that generates code and runs tasks.
- A routing system that maps URLs to controllers.
- Authentication and authorization.
- Database migrations and queue management.
- Event broadcasting and testing support.
Laravel favours convention over configuration, so following its folder layout and naming rules saves setup work.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the MVC architecture in Laravel
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Laravel's Model-View-Controller (MVC) architecture splits each request across three parts. Models handle data, views render output, and controllers connect the two.
- The model is an Eloquent class that holds data logic and talks to the database.
- The view is a Blade template that turns data into HTML.
- The controller receives the request, asks models for data and hands it to a view.
A request first matches a route, which calls a controller method. The controller reads or writes data through models and gets the results back. It then returns a view, and Laravel sends the rendered view as the response.
Because each layer has one job, you can change a template without touching queries. You can also test models and controllers on their own.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is Composer and how is it used in Laravel?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Composer is PHP's dependency manager, and Laravel uses it to install and autoload every package the app needs. You list dependencies in composer.json, and Composer records the exact installed versions in composer.lock.
composer install # Install dependencies
composer update # Update dependencies
composer dump-autoload # Regenerate PSR-4 autoload
composer require package # Add new package
composer install reads the lock file, so every machine gets the same versions. composer update resolves newer versions and rewrites the lock file.
Composer also builds the PSR-4 autoloader, which loads a class such as App\Models\User from its file path without manual require calls. A new project usually starts with composer create-project laravel/laravel.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you define routes in Laravel?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
You define a route by mapping an HTTP verb and a URI to a closure or a controller method, in a file under routes/. The router has one method per verb, such as Route::get() and Route::post().
Web routes go in routes/web.php. They get the web middleware group, which adds sessions and protection against cross-site request forgery (CSRF). API routes go in routes/api.php. Current Laravel versions create that file only when you run php artisan install:api. Laravel adds the /api prefix to every route in it.
Route::get('/users', [UserController::class, 'index']);
Route::post('/users', [UserController::class, 'store']);
Route::put('/users/{id}', [UserController::class, 'update']);
Route::delete('/users/{id}', [UserController::class, 'destroy']);
// Resource route (creates all CRUD routes)
Route::resource('posts', PostController::class);
Route::resource() registers the full set of CRUD routes for a controller in one line. You can name a route with ->name() and list every route with php artisan route:list.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are route parameters and how do you use them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Route parameters are placeholders in a URI, written in braces, that capture segments of the URI and pass them to your closure or controller. Laravel passes them in order, so the arguments must follow the order of the placeholders.
// Required parameter
Route::get('/user/{id}', function ($id) {
return "User ID: $id";
});
// Optional parameter
Route::get('/hello/{name?}', function ($name = 'Guest') {
return "Hello, $name";
});
// Regular expression constraint
Route::get('/post/{id}', function ($id) {
//
})->where('id', '[0-9]+');
A required parameter like {id} must be present. An optional parameter adds a ?, and its argument needs a default value.
A parameter matches one segment, so it stops at a slash unless a where() constraint allows one. The where() method adds a regular expression constraint, and a URI that fails it gets a 404. Routes are matched in the order they are registered, so each example here uses its own URI.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are resource controllers and how do they work?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A resource controller has one method for each standard action on a resource, so a single Route::resource() line wires up all its CRUD routes. You generate one with the --resource flag.
// Generate: php artisan make:controller PostController --resource
// Route: Route::resource('posts', PostController::class);
The seven methods map to verbs and URIs like this:
index()lists resources atGET /posts.create()shows the creation form atGET /posts/create.store()stores a new resource atPOST /posts.show($id)displays one resource atGET /posts/{post}.edit($id)shows the edit form atGET /posts/{post}/edit.update($id)updates a resource atPUT /posts/{post}orPATCH.destroy($id)deletes a resource atDELETE /posts/{post}.
Each route also gets a name such as posts.index. For a JSON API, Route::apiResource() leaves out create and edit, since an API serves no HTML forms. Chain only() or except() to register a subset.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is Eloquent ORM and its advantages?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Eloquent is Laravel's object-relational mapper (ORM), which maps database tables to PHP classes. It follows the Active Record pattern. Each database table has a corresponding model class, and each model instance is one row.
Its main advantages:
- Simple, expressive syntax, such as
User::where('active', 1)->get(). - Relationship management, such as
hasMany. - Automatic
created_atandupdated_attimestamps. - Soft deletes, which hide a row instead of removing it.
- Query scopes, which are reusable query conditions.
- Accessors and mutators, which change a value when it is read or written.
- Model events, which run code when a model is saved.
The trade-off is speed. Eloquent builds a full model object for every row, while the query builder, called through DB::table(), returns plain rows. Large reports often run faster through it.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain database migrations in Laravel
What is the difference between authentication and authorization?
What is Blade and what are its key features?
Explain Blade template inheritance
How do you pass data to Blade views?
What are Laravel Collections and why use them over plain arrays?
What is the service container in Laravel?
Explain Service Providers in Laravel
Explain route groups and their benefits
What is route model binding?
How do you handle validation in Laravel?
What is dependency injection in Laravel controllers?
Explain Eloquent relationships
What are Eloquent accessors and mutators?
What are query scopes in Eloquent?
How does soft delete work in Laravel?
What is the N+1 query problem and how do you solve it?
What is middleware and how does it work?
What is the difference between global and route middleware?
How does Laravel handle authentication?
How do you implement authorization using Gates?
Explain Laravel Policies
What are Blade components and how do you use them?
What caching mechanisms does Laravel support?
What is route caching and when should you use it?
How do queues work in Laravel?
Explain the event-listener pattern in Laravel
What are model events in Laravel?
How do you build RESTful APIs in Laravel?
What is Laravel Sanctum and when should you use it?
How do you handle API versioning in Laravel?
What types of testing does Laravel support?
What are database seeders and factories in Laravel?
How does Laravel protect against CSRF attacks?
What security features does Laravel provide out of the box?
What are the key steps for deploying a Laravel application?
What are facades in Laravel and how do they work?
What is mass assignment and how does Laravel protect against it?
How does task scheduling work in Laravel?
How do you use database transactions in Laravel?
What are job batches in Laravel?
What are some Laravel performance optimization techniques?
What is a lazy collection and when should you use it?
What are Laravel macros and how do you use them?
Explain Laravel's pipeline pattern
What are Laravel packages and how do you create one?
How does Laravel handle real-time events with broadcasting?
Walk me through the Laravel request lifecycle
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Laravel in pictures.
A quick recap of Laravel in 32 short animated pictures, one idea at a time. About 8 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.
Pro The first chapter is free to play. The other 30 pictures come with Pro.
Laravel cheatsheet
- How a Laravel app runs01
- Container & providers02
- Routes, middleware & input03
- Eloquent models04
- Database & collections05
- Blade views06
- Login, roles & security07
- REST APIs & tests08
- Queues, events & real time09
- Caching & deployment10
- The model11
- + 5 more inside
This picture is part of Pro. The first chapter is free to play; the other 30 pictures come with Pro.
Get Pro · $10/mo Already Pro? Sign in48 of 55 Laravel answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.