WebReinvent Technologies
Pavitra Plus Interview Questions and Answers
Q1. What is international format to store dates in PHP? How to access it?
The international format to store dates in PHP is 'Y-m-d H:i:s'. It can be accessed using the date() function.
Use 'Y-m-d H:i:s' format to store dates in PHP
Access it using the date() function in PHP
Q2. What is difference between jobs and batch?
Jobs are individual tasks that are executed independently, while batches are groups of tasks executed together.
Jobs are typically smaller in scope and run independently, while batches involve multiple tasks grouped together.
Jobs can be queued and processed asynchronously, while batches are usually executed synchronously.
Examples of jobs include sending an email, processing an image, or updating a database record. Examples of batches include importing a CSV file, running a ser...read more
Q3. What is polymorphic relationship?
Polymorphic relationship is a type of relationship in which a model can belong to multiple other models on a single association.
Allows a model to belong to multiple other models on a single association
Uses a single column in the database to store the type of the related model
Commonly used in scenarios where a model can belong to multiple other models such as comments, likes, or tags
Q4. What is trait used for?
Traits are used in PHP to group functionality in a fine-grained and reusable way.
Traits allow you to reuse methods in multiple classes without inheritance limitations.
They provide a way to compose classes that is more flexible than single inheritance.
Traits can be used to share methods among classes that are unrelated in terms of inheritance.
An example of using traits in Laravel is the 'SoftDeletes' trait which adds soft deletion capabilities to models.
Q5. What are the observers.
Observers in Laravel are classes that listen for specific model events and trigger actions based on those events.
Observers are used to decouple event listeners from models.
They can listen for various model events like creating, updating, deleting, etc.
Observers are defined by creating a class that extends the Eloquent model observer class.
Example: Creating a UserObserver class to send an email notification when a new user is created.
Q6. What are accessor and mutator
Accessors and mutators are methods used in Laravel Eloquent models to manipulate attribute values before retrieving or saving them.
Accessors are used to modify attribute values when retrieving them from the database
Mutators are used to modify attribute values before saving them to the database
Accessors and mutators are defined as methods in the Eloquent model class
Example: public function getFullNameAttribute() { return $this->first_name . ' ' . $this->last_name; }
Q7. What is Laravel ?
Laravel is a popular PHP framework for web application development.
Laravel provides a clean and elegant syntax for writing code.
It follows the MVC (Model-View-Controller) architectural pattern.
Laravel includes features like routing, authentication, and caching out of the box.
It has a powerful ORM (Object-Relational Mapping) called Eloquent for database interactions.
Laravel has a vibrant community and extensive documentation for support.
Q8. What is MVC ?
MVC stands for Model-View-Controller, a software design pattern for organizing code in a way that separates concerns.
Model represents the data and business logic of the application.
View is responsible for displaying the data to the user.
Controller acts as an intermediary between Model and View, handling user input and updating the Model accordingly.
Interview Process at Pavitra Plus
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month