List of laravel interview question which are most widely asked.
Click ⭐if you like the project. Pull Requests are highly appreciated.
-
Laravel events provide simple observer implementation, allowing you to subscribe and listen to various events that occur in your application.events classes are stored in app/Events dictionary & listeners are stored in the app/Listeners dictionary. They will create when using artisan console for Events & Listeners.
-
Service providers are the central place where your application is bootstrapped. Laravel core services also bootstrapped by service providers. All service providers extend Illimunate\Support\ServiceProvider class. Which contains the boot and register method.
-
You can register service providers in the config/app.php configuration file that contains an array where you can mention the service provider class name.
-
It is useful in resolving class dependencies and performing dependency injection in Laravel. Dependency - class dependencies are “injected” into the class via the constructor or, in some cases, “setter” methods.
-
Dependency injection is a technique whereby one object supplies the dependencies of another object. A dependency is an object that can be used (a service). You can do dependency injection via Constructor, setter and property injection.
-
Laravel contract is a set of interfaces that define core services provided by the Laravel framework.
-
Laravel facades are nothing but interfaces, that are available in the application service provider.
-
Laravel's Eloquent ORM is a simple Active Record implementation for working with your database.
-
The Laravel queue service provides a unified API across a variety of different queue back-ends. Queues allow you to defer the processing of a time-consuming task, such as sending an e-mail, until a later time which drastically speeds up web requests to your application. Queue driver used - Redis server.
-
DB::connection()->enableQueryLog();
-
Traits are a simple group of methods that you want to include in another class. A Trait, like an abstract class, cannot be instantiated by itself. The trait is created to reduce the limitations of single inheritance in PHP by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies.
-
Acts middle man between request and response. Two types - Global Middleware - It will apply to every route request. Route Middleware - It is applicable for a particular route.
-
we can use $request->ajax() method to check request is ajax or not.
-
While processing a large amount of data, you can use the cursor method in order to reduce memory usage.
-
Laravel exceptions are handled by App\Exceptions\Handler class.
-
It is a type of module or packages which is used to create fake data. This data can be used for testing purposes. It is can also be used to generate: 1) Numbers, 2) Addresses, 3) DateTime, 4) Payments, and 5) Lorem text.
-
Use hasTable() Laravel function to check the desired table is exists in the database or not.
-
Insert(): This function is simply used to insert a record into the database. It not necessary that ID should be autoincremented. InsertGetId(): This function also inserts a record into the table, but it is used when the ID field is auto-increment.
-
Laravel guard is a special component that is used to find authenticated users. The incoming requested is initially routed through this guard to validate credentials entered by users. Guards are defined in ../config/auth.php file.
-
One To One One To Many One To Many (Inverse) Many To Many Has Many Through Polymorphic Relations Many To Many Polymorphic Relations
-
count() max() min() avg() sum()
-
A namespace allows a user to group the functions, classes, and constants under a specific name.
-
It is a technique in which system log generated errors. Loggin is helpful to increase the reliability of the system. Laravel supports various logging modes like Syslog, daily, single, and error log modes.
-
It is the method of converting text into a key that shows the original text. Laravel uses the Hash facade to store the password securely in a hashed manner.
-
Laravel provides various methods that we can use in queries to get records with our conditions. These methods are given below where() orWhere() whereBetween() orWhereBetween() whereNotBetween() orWhereNotBetween() wherein() whereNotIn() orWhereIn() orWhereNotIn() whereNull() whereNotNull() orWhereNull() orWhereNotNull() whereDate() whereMonth() whereDay() whereYear() whereTime() whereColumn() orWhereColumn() whereExists()