Skip to main content

10. Laravel

What is the MVC architecture and how does Laravel implement it?​

Junior

Answer: MVC stands for Model-View-Controller.

  • Model: Represents the data structure (Eloquent).
  • View: Displays the data (Blade templates).
  • Controller: Handles logic and user input.

What is Eloquent ORM?​

Junior

Answer: Laravel's built-in Object-Relational Mapper that allows you to interact with your database using PHP objects instead of raw SQL.


What is Blade?​

Junior

Answer: Blade is Laravel's powerful and simple templating engine, allowing you to use plain PHP in your templates with a clean syntax.


What is Routing in Laravel?​

Junior

Answer: Mapping HTTP requests (URLs) to specific controller actions or closures.


What are Named Routes?​

Junior

Answer: Assigning a name to a route to allow generating URLs or redirects by referencing the name instead of the raw URL.


What are Route Groups?​

Junior

Answer: A way to group multiple routes that share common attributes (like middleware or prefixes).


What are Seeders and Factories?​

Junior

Answer:

  • Seeders: Populate the database with test/dummy data.
  • Factories: Define the blueprint for generating dummy model data.

What is Soft Delete?​

Junior

Answer: Marking a record as deleted without actually removing it from the database, typically using a deleted_at column.


What is the Laravel Service Container?​

Middle

Answer: A powerful tool for managing class dependencies and performing dependency injection. Service Container Deep Dive


What are Collections?​

Middle

Answer: A wrapper around PHP arrays that provides a powerful, fluent interface for manipulating data (e.g., map, filter, reduce).


What is Middleware?​

Middle

Answer: A filter that inspects and filters HTTP requests entering your application (e.g., authentication, logging).


What are Service Providers?​

Middle

Answer: The central place of all Laravel application bootstrapping. They bind services into the Service Container.


What are Migrations?​

Middle

Answer: Version control for your database, allowing you to define your table structure in PHP code.


What is the difference between Authentication and Authorization?​

Middle

Answer:

  • Authentication: Verifying who the user is (e.g., login).
  • Authorization: Verifying what the user is allowed to do (e.g., permissions).

What are Facades in Laravel?​

Senior

Answer: They provide a "static" interface to classes available in the Service Container. They serve as "proxy" classes for accessing underlying implementations.


What are Events and Listeners?​

Senior

Answer: A way to decouple components in your application. An event is dispatched, and one or more listeners react to it.


What are Contracts in Laravel?​

Senior

Answer: A set of interfaces that define the core services provided by the framework. They allow for swapping underlying implementations.


What are Service Container and Service Provider roles?​

Senior

Answer:

  • Service Container: The registry of all dependencies.
  • Service Provider: The classes that register and boot those dependencies into the container.