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 TotalWhat is the N+1 query problem and how do you fix it in Eloquent?
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.
How does the Laravel Service Container resolve dependencies?
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.
What are Laravel Accessors and Mutators?
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).
What is a Middleware in Laravel?
Middleware provides a convenient mechanism for inspecting and filtering HTTP requests entering the application, commonly used for authentication or logging.
How do you handle heavy background tasks in Laravel?
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.