arrow_back Back to Curriculum
apps

Laravel Framework

The most popular enterprise framework in the Pakistani IT sector. Focuses on Eloquent internals, the Service Container, N+1 issues, and queue management.

Interview Questions

5 Total
Q1.

What is the N+1 query problem and how do you fix it in Eloquent?

Hard

N+1 occurs when you fetch N records and then execute an additional query for each record to fetch relationships. In Laravel, it is solved using Eager Loading via the `with()` method.

Q2.

How does the Laravel Service Container resolve dependencies?

Hard

It resolves dependencies automatically using PHP Reflection. If a class relies on an interface, the container checks its bindings to provide the correct defined implementation.

Q3.

What are Laravel Accessors and Mutators?

Medium

Accessors and mutators allow you to format Eloquent attribute values when you retrieve or set them on model instances (e.g. capitalizing a name or hashing a password).

Q4.

What is a Middleware in Laravel?

Easy

Middleware provides a convenient mechanism for inspecting and filtering HTTP requests entering the application, commonly used for authentication or logging.

Q5.

How do you handle heavy background tasks in Laravel?

Medium

By using Laravel Queues. We can push time-consuming tasks like sending emails or processing images to a queue (like Redis or database) to be handled asynchronously by workers.