InfyOm Blog


In our daily life, we are going through lots of packages, and some of us don't know how to build our own package into Laravel.

We are going to perform the core steps to create your own package in laravel. In this tutorial we are going to build zoom package, so we will perform steps related to it.

Setup Fresh Laravel Repo 

Setup fresh laravel repo, and then create directories within it. 

for e.g Create infyomlabs/zoom-api directory into root.

Now create src directory into zoom-api

Run Composer init Into src Directory

After hitting composer init it will ask some information from you, as you can see in below image I have entered some of information. you can just hit enter if you do not want to add other information.

Add your config file (Optional)

Create directory config into src directory and add your config.php file there from where you can manage your env variables. 

Add Service Provider

Create your service provider from where you can do lots of actions. like you can publish config/routes/ migrations files from there. here we are publishing the zoom config file. 

Add your class (Which contains all functions) 

Here we have added a Zoom class which will be contained all zoom functions. 

Update Composer.json 

Finally, Test it in your existing project

Put the following code to your main composer.json (in your project's root). and hit composer update

  "repositories": [
            "type": "path",
            "url": "infyomlabs/zoom-api",
            "options": {
                "symlink": true
    "license": "MIT",
    "require": {
        "infyomlabs/zoom-api": "dev-develop"

January 27, 20211 minuteuserVishal Ribdiya



Recently in one of our client's project, we want to load the count of relation in laravel. But we do not want to retrieve original records.

For example,

We have the following Models,

  1. Category
  2. Products
  3. Orders

For that, we have categories, products, orders, order_items table. Where in the order_items table, we got the following fields

  • order_id
  • product_id
  • quantity

So the requirement was, In the Products table, we want to display the total number of orders placed with that item regardless of the quantity in each order. All we need is a number of orders where the product is purchased.

1st way: Query via Relationship

$products = Product::all();
$productsArr = $products->map(function (Product $product) {
    $productObj = $product->toArray();
    $productObj['orders_count'] = $product->orders()->count();
    return $productObj;

But the problem with this approach was, we are firing queries to the database for every single product. so if I'm retrieving 100 Products from the database then it will fire 100 additional queries to the database. Imagine if we have thousands of products.

2nd way: Eager Load Relationship and Calculate Count

$products = Product::with('orders')->get();
$productsArr = $products->map(function (Product $product) {
    $productObj = $product->toArray();
    $productObj['orders_count'] = $product->orders->count();
    return $productObj;

so this way, we are only firing two queries to the database. But the problem here is, we are loading all the Orders of each product which we don't need at all. so it will consume lots of memory since we are loading lots of orders. so imaging if we retrieve 100 products, and each product has 10 orders, then we are loading 1000 Orders into memory without any need.

3rd way: Use withCount function

The third powerful approach of using withCount function in Laravel. so we refactored our code like,

$products = Product::withCount('orders')->get();
$productsArr = $products->map(function (Product $product) {
    $productObj = $product->toArray();
    $productObj['orders_count'] = $product->getAttribute('orders_count');
    return $productObj;

In this approach, we are firing two queries but no Order models are loaded into memory.

4th Bonus: Using in a nested relationship while multiple eager loading

You can even use it with nested relationships. Imagine a case, where you want to retrieve categories along with its products with orders count.

$categories = Category::with([
    'products' => function ($query) {
$categoriesArr = $categories->map(function (Category $category) {
    $categoryObj = $category->toArray();
    $categoryObj['products'] = $category->products->map(function (Product $product) {
        $productObj = $product->toArray();
        $productObj['orders_count'] = $product->getAttribute('orders_count');
        return $productObj;
    return $categoryObj;

Hope this will help you to retrieve the count of relationship data without retrieving actual relation data.

September 18, 20202 minutesauthorMitul Golakiya
Different Types Of Software Testing 

Given below is the list of some common types of Software Testing: 

Accessibility Testing:

The purpose of accessibility testing is to determine whether the software or application is accessible to people with disabilities or not.  Here disability means deaf, color-blind, mentally disabled, blind, elderly, and other disabled groups.  Various checks are performed, such as font size for the visually impaired, color and contrast for color blindness, etc. 

Ad-Hoc Testing:

The name itself suggests that this test will be conducted on an ad hoc basis, i.e. without reference to the test case and also without a plan or documentation for such type of test.  The aim of this test is to find the flaws and breaks the application is executed by executing any sequence of application or random functionality.  Ad hoc testing is an informal way of finding bugs and can be done by anyone on the project.  It is difficult to identify bugs without a test case, but sometimes it is possible that bugs found in ad hoc tests were not identified using existing test cases. 
Alpha Testing:

It is the most common type of test used in the software industry.  The objective of this test is to identify all possible problems or defects before launching it to the market or to the user.  Alpha Testing takes place at the end of the software development phase but before Beta Testing.  Still, minor design changes can be made as a result of such testing.  Alpha testing is done on the developer's site.  An internal virtual user environment can be created for this type of test.

API Testing:

API testing is done for the system, which has a collection of APIs that should be tested.  During the test, a test of the following things is examined: explore the boundary conditions and ensure that the test harness varies the parameters of the API calls in order to verify functionality and expose faults.  Parameters. Checks the API behavior that is considering external environment conditions such as files, peripheral devices, etc. Check the sequence of API calls and check if the APIs produce useful results from subsequent calls. 

Beta Testing:

Beta tests, also known as user tests, are carried out by the end users at the end user's location to verify the usability, functionality, compatibility and reliability tests to provide input on the design, functionality and usability of a product.  These inputs are not only critical to the success of the product, but also an investment in future products if the data collected is effectively managed. 

Boundary Testing:

Boundary value analysis is a type of black box or specification based testing technique in which tests are performed using the boundary values.


An exam has a pass boundary at 50 percent, merit at 75 percent and distinction at 85 percent. The Valid Boundary values for this scenario will be as follows:

49, 50 - for pass
74, 75 - for merit
84, 85 - for distinction

Boundary values are validated against both the valid boundaries and invalid boundaries.
The Invalid Boundary Cases for the above example can be given as follows:

0 - for lower limit boundary value
101 - for upper limit boundary value
Bottom-Up Integration Testing:

Each component at the lower hierarchy is tested individually and then the components that rely upon these components are tested.

Bottom-Up Integration - Flow Diagram 

The order of Integration by Bottom-down approach will be:


Top-Down Integration Testing:

Top-down integration testing is an integration testing technique used in order to simulate the behavior of the lower-level modules that are not yet integrated. Stubs are the modules that act as temporary replacement for a called module and give the same output as that of the actual product.
The replacement for the 'called' modules is known as 'Stubs' and is also used when the software needs to interact with an external system.
topdown.PNG 59.36 KB

The above diagrams clearly states that Modules 1, 2 and 3 are available for integration, whereas, below modules are still under development that cannot be integrated at this point of time. Hence, Stubs are used to test the modules. The order of Integration will be:

2,Stub 1
2,Stub 2
3,Stub 3
3,Stub 4

Unit Testing:

Unit testing, which is a testing method by which individual units are tested to determine if there are any issues on the part of the developer themselves.  It is concerned with the functional health of the independent units. 

The main aim is to isolate each unit of the system to identify, analyze and fix the defects.

Unit Testing - Advantages:

  • Reduces errors in the newly developed functions or reduces errors when changing the existing functionality. 
  •  Reduces test costs as errors are detected at a very early stage.
  •   Improves the design and allows for better code redesign.
  •   Unit tests also show the quality of the build when integrated into Build. 
Unit Testing Lifecycle: 

unit testing life cycle.PNG 136.36 KB
Unit Testing Techniques:

  • Black Box Testing - Using which the user interface, input and output are tested.
  • White Box Testing - used to test each one of those functions' behavior is tested.
  • Gray Box Testing - Used to execute tests, risks and assessment methods. 
System Testing:

System testing (ST) is a black box testing technique performed to assess the complete system's compliance with specified requirements.  In system testing, the functionalities of the system are tested from an end-to-end perspective.  System testing is generally carried out by a team that is independent of the development team to measure the quality of the system in an unbiased manner.  Includes functional and non-functional tests. 

Types of System Tests:


Sanity Testing:

Sanity testing, which is a software testing method that the testing team performs for some basic tests.  The goal of the core test is to perform it whenever a new test architecture is received.  Terms such as smoke test, build validation test, basic acceptance test, or health test are used interchangeably, however, each of them is used under a slightly different scenario,
The sanity test is usually unwritten, and helps to identify missing dependent functions.  It is used to determine if the app partition is still working after making a slight change.  
The general health test can be both narrow and profound.  A mind test is a narrow regression test that focuses on one or several domains of functions. 

Smoke Testing:

The smoke test is a testing technique that is inspired by the hardware test, which checks for smoke from hardware components once the hardware is turned on.  Similarly, in the context of software testing, the smoke test refers to testing the basic functionality of the build.  If the test fails, the build is declared unstable and is NOT tested again until the build smoke test is passed. 

Smoke Testing - Features:

  • Identify the business-critical functions that a product must perform.  
  • Design and run the basic functions of the application. 
  •  Make sure the smoke test passes each and every build to continue testing.  
  • Smoke testing enables obvious errors to be revealed, saving time and effort .
  • Smoking testing can be manual or automated. 
Interface Testing:

Interface testing is performed to assess whether systems or components are passing data and properly controlling each other.  It is to check if all interactions between these modules are working properly and errors are handled properly. 

Interface Testing - Checklist

  • Check that communication between systems is done correctly
  •  Check if all supported hardware / software has been tested 
  • Check if all related documents are supported / open on all platforms
  •  Check security requirements or encryption when communicating between  application server systems 

Regression Testing:

Regression testing for a black box testing technique that consists of re-executing those tests that are affected by code changes.  These tests should be performed as much as possible throughout the software development life cycle. 

Types of Regression Tests:

  • Final Regression Tests: - A "final regression testing" is performed to validate the build that hasn't changed for a period of time. This build is deployed or shipped to customers.
  • Regression Tests: - A normal regression testing is performed to verify if the build has NOT broken any other parts of the application by the recent code changes for defect fixing or for enhancement.
Selecting Regression Tests:

  • Requires knowledge of the system and its effects on the existing functions.  
  • Tests are selected based on the area of ​​common failure. 
  •  Tests are chosen to include the area where code changes have been made multiple times. 
  •  Tests are selected based on the criticality of the features. 
 Regression Testing Steps:

  • Regression tests are the ideal cases of automation which results in better Return On Investment (ROI).
  • Select the regression tests.
  •   Choose apt tool and automate regression testing. 
  •  Verify applications with checkpoints. 
  •  Manage regression testing and update as needed.
  •   Schedule tests.
  •   Integrate with builds.
Load Testing:

Load testing is a performance testing technique using which the response of the system is measured under various load conditions. The load testing is performed for normal and peak load conditions

Load Testing Approach:

  • Evaluate performance acceptance criteria.
  •  Identify critical scenarios.
  •  Design the workload model.
  • Identify target load levels.
  •  Design the tests.
  •  Run the tests.
  • Analyze the results 
Objectives of Load Testing:

  • Response time.
  •  Resource usage rate.
  •  Maximum user load.
  • Work-related metrics 
Stress Testing:

Stress testing is a non-functional testing technique performed as part of performance testing.  During stress testing, the system is monitored after overloading the system to ensure that the system can withstand the stress. System recovery from this phase (after stress) is very critical as it is very  likely to occur in the production environment. 

Reasons for performing stress tests: 

  • This allows the test team to monitor the performance of the system during failures. 
  • To check if the system saved data before crashing or NOT. 
  • To check if the system is printing messages  Significant error during a failure or if it has printed random exceptions 
  • To check whether unexpected failures do not lead to safety issues 
Stress Tests - Scenarios: 

  • Monitor the behavior of the system when the maximum number of  'users are logged in at the same time
  •  All users performing critical operations at the same time
  •  All users Accessing the same file
  •  Hardware issues such as the downed database server or some of the servers in a downing farm  breakdown. 
Compatibility Testing:

Compatibility testing is a non-functional testing conducted on the application to evaluate the application's compatibility within different environments. It can be of two types - forward compatibility testing and backward compatibility testing.

  • Operating system Compatibility Testing - Linux, macOS, Windows
  • Database Compatibility Testing - Oracle SQL Server
  • Browser Compatibility Testing - IE, Chrome, Firefox
  • Other System Software - Web server, networking/ messaging tool, etc.
Localization Testing:

Localization testing is a software testing technique by which software behavior is tested for a specific region, locality, or culture.  The purpose of conducting the localization test for a program is to test the appropriate linguistic and cultural aspects of a particular site. 

Software Testing Methods

There are various methods for testing software. These methods are chosen by testers based on their requirements and methodologies. But three fundamental software testing methods are used in every project development.

Types of Software Testing Methods and Levels

  • White Box Testing
  • Black Box Testing
  • Grey Box Testing
White Box Testing & Levels

The White Box Test is also known as the Open / Clear Box Test / Glass Box Test.  From a developer's perspective, it is known as Code Oriented Testing / Structural Testing.  In This type of testing, technical tests can be performed within the internal structure, logical design and implementation of different modules.  Here, the tester uses preferred input / exercise paths via code to determine the correct or exact output.  is known as code-oriented testing, it contains technical tests and script-based tests as part of its testing phase. 

White Box Testing Levels

  • Unit Testing
  • Integration Testing
  • System Testing
Black Box Testing & Levels

This test is known as a behavior test, in which the software tests the internal structure, design and implementation, as well as the user interface and UX of the software under test, which are not known to the tester.  Black box tests are both functional and non-functional, but most of the time they are functional.  This testing technique is known as black box testing because the software or product is not known / confirmed to the tester in advance. 
Using this technique of testing to find errors in these mentioned categories:

  • Software malfunction.
  •  Error in interface.
  •  Errors in concepts.
  •  Errors related to the database.
  • Performance or behavior errors.
  • Errors in product startup or termination 
Black Box Testing Levels

  • Integration Testing
  • System Testing
  • Acceptance Testing
Grey Box Testing & Levels

In this software testing technique, it combines the concept of black box and white box testing.  In the gray box test, the inside of your product is partly known to the tester.  This has partial access to data structures residing internally to design different test cases, but at the same time testing from a user's perspective or as a black box tester. 

“Still There are various methods for testing software. These methods are chosen by testers based on their requirements and methodologies.”
September 18, 202011 minutesauthorBhumi Khimani
Here is part one of How To Grow Your Business - 1

You can only develop products and services that are very effective if you pay attention to the needs of your customers and prospects. One way to understand exactly what your customers want is through research and surveys.

8. Create a sales funnel
The first way to grow your business faster is by creating a sales funnel. If you do not have a sales funnel, you are making a big mistake. Sales funnels can help automate your business.
It helps you grow and grow quickly and easily. Sure, there are some front-end functions involved. Is natural. But, once those processes are suspended, it will travel easily from there.

9. Use a customer management system
Manually tracking transactions is difficult. No one wants to do that. It becomes a burden as the business grows. If you want to scale quickly, use a customer management system.

10. Competition research
When going to the market, and you are really looking to get your offer out to the public, you need to research the competition. Frasier says he uses two platforms to do his own research. The first is the same web.

11. Create a customer loyalty program
Loyalty programs are the best way to increase sales. It costs three times more to acquire new customers than to sell something to an existing customer.
Other resources pin this number anywhere from four to 10 times more. However, whichever way you cut it, getting new customers is expensive.

12. Identify new opportunities
Analyze new opportunities in your business by better understanding your demographics. Understand everything from distribution channels to your direct competitors, and also analyze overseas markets and other potential industries.
With the right amount of potential analysis, you are likely to immediately pursue dozens of new opportunities.

13. Create an email list
One of the best and most effective ways to grow a business quickly is to create an email list. Clearly, that means you need to have a lead magnet.

14. Think of the franchise model.
If you have a successful business, and you are trying to grow really fast, consider franchising it. Although franchise costs are high and moving towards a franchise model is complex and it takes a lot in marketing, how can it all make a difference if you are looking for really fast growth.
September 15, 20202 minutesauthorAnkit Kalathiya
We all know that human behavior is difficult to understand & explain yet we need to take care of our Human Capital to develop & maintain the productivity & profitability of the organization.

In the last blog, we have discussed what is Morale, Characteristics of Morale, Relation between morale and Productivity. Let’s  move further to-

   Factors determining morale
  Measurement of Morale: why ??

Factors Determining morale :    
  • Sound & Effective Organisation
  • Opportunity to rise 
  • Remuneration 
  • Personal attributes
  • satisfaction level
  • Supervision level
  • Nature of work

 It may sound surprising but the Organisation Itself plays a significant role in shaping an employee's attitude. The NAME & FAME  of the Organisation plays vital roles to determine employee morale. The Reputation of the organization builds the attitude of their employee better or worse towards it... For Instance- Someone who works for Google is more likely to take ownership in comparison to the person who is working for a small XYZ software company.

2- Opportunity to rise- 
If the person found their personal growth within the organization, it boosts the morale of an employee. On the other side  no possibility of personal growth decrease Morale of the employee 

3-Personal attributes -
Physical and mental health also play a major role in determining employee Morale. If the person is not physically or mentally fit for a particular role, this can be an obstacle in learning and progress at the workplace It leads to low morale.

It's a vital factor to determine the level of employee morale, If the employee feels he/she discriminates based on pay scale it leads to dissatisfaction with the organization.

5-Satisfaction level-
If employees are satisfied with the Work role, there will be more energy in the system. Satisfaction arrived from various factors such as Company image, Pay scale, Working conditions, Growth opportunities, Welcoming attitude of new ideas, learning attitudes, Training, etc.

6- Supervision Level- 
The level of supervision received by an employee is a tremendous factor that affects morale. More the supervision, less the enthusiasm. No one likes a big boss over his/her head. Too much monitoring and supervision make people feel nervous and this hampers the performance rather than improving it.

7-Nature of work- 
The nature of work also plays a significant role in employee morale. If the work is repetitive or involve long working hours it affect employee morale negatively 

Measurement of Morale-

The big question is why we need to measure employee morale ???? 

The company depends on employees for Everything from production to accounting & finance (Profit & loss ). If they are happy, they perform their job more efficiently which upsurge the success of the business as well as profitability. On the other side, poor employee Morale can harm Business-dropping productivity and raising the turnover rate.
While running the business we should constantly pay attention to our employee morale to maintain the health of the organization.

While measuring Employee Morale we need to consider following things-

  • Ask the right question 
  • Don’t ask anything in annoying way
  • Follow the performance data first 
  • Take the employee of the clock 
  • Listen to what they say
  • Keep eye on their project 

Well, Employee morale is a broad concept. To know more about Employee Morale please read my upcoming blog…

In the next blog, we will see Measurement of employee morale, Significance of high morale, Demerits of low morale…..

September 13, 20203 minutesauthorMariyam Bemat

Lots of people ask me frequently, "Which are the laravel packages that you use in almost all projects?" when we meet in Meetup or any other events regardless of its online or physical events.

Let me describe today some of the packages that we almost use in all of the projects.

We are working in Laravel for almost 7+ years and in these years we have used lots of packages, some from the community and some of our own.

I am categorizing these into 2 categories.

  1. Must used packages
  2. Common Need/Functionality specific packages

Must used packages

These are the packages which are must be included in all of our projects. No Excuses.


Laravel exposes a lot of magic methods and properties. IDE Helper is a very good package when it comes to auto-complete those properties and methods. Even it does an amazing job while refactoring properties or methods of the model.


The second one is from the same author, debugbar helps to debug the request in terms of the number of queries fired, time taken by each query, number models retrieved from db, time taken by each request, and much more.


Laravel Microscope improves the readability of your code. Early returns, unnecessary else statements, and many more. so your code looks clean and efficient in terms of execution as well.


One of the problems that we face is, missing eager loading. In ongoing development, sometimes we add relationships objects in the loops, and then laravel fires tons of queries to the database. Laravel Query Detector detects that and gives warning while development environment.


No application can be ever built without few CRUDs. CRUDs are essential in almost all web applications. Also, APIs of that CRUDs are essentials while building a backend for Mobile or Frontend apps. Laravel Generator is our own developed package that we use in all of the applications to make the CRUD building process faster. It can be used with two themes right now, AdminLTE and CoreUI. But it's also frontend framework agnostic.

Common Need/Functionality specific packages

These are the packages that are used when we particularly need that kind of functionality in the application.

Will keep this list updating.

September 11, 20202 minutesauthorMitul Golakiya
Step 1: Selection of your Subject

select any selection tool for selection but select the Quick selection tool.
select your subject and press select and mask
1.PNG 951.63 KB
Step 2: Edit your Subject

  1. open property and select onion skin and transparency 50%
  2. refine edge brush tool and then refine edge
  3. Set contrasts 9%
  4. output setting on
  5. tick decontaminate colors amount 100%
  6. output to a new layer with layer mask then press OK
2.PNG 905.94 KB
Step 3: Crop Upper part of the subject

select layer mask and press ctrl + click for selection and new cut out the upper part to polygonal lasso tool. select perfectly then select layer and ctrl+j for duplicate layer

3.PNG 928.87 KB
Step 4: create an effect for Background

create Ctrl+G for group layer select the last layer and create color lookup effect.
then 3D lut file and select moonlight.3dl. and then Create a new effect black & white
Opacity set 50%

4.PNG 945.25 KB
Step 5: Create Effect for Main Subject

select the group layer and convert this layer to a Smart Object.
then create this layer duplicate. then create a color style to the top layer in linear Dodge(Add).
then go to the
5.PNG 946.37 KB

1.filter - blur - Gaussian blur Create radius - 5 for soft edges
2.Create a duplicate layer and double click on the smart filter and Create a radius of 100

6.PNG 765.61 KB
3.again Create a duplicate layer and double click on the smart filter and Create a radius of 250
4. again Create duplicate layer and double click on the smart filter and **Create a radius of 500

then add hue/saturation adjustment layer
and click on create clipping mask then click on colorize and increase the saturation to your perfect and choose a color

7.PNG 1.02 MB
Step 6: Create All effect in the subject

select main layer mask image and create effect curves.
and click on create effect curves and click on create clipping mask and curves per requirement select layer mask and select the brush tool. and set property
opacity 100%
flow 30%

8.PNG 994.62 KB
create duplicate hue/saturation effect layer and set this layer is bottom of the main object and select this layer and open property and click ok create a clipping mask.
and select the mask and make sure the foreground color is white.
and give shade to the object and you can also adjust the opacity.

Step 7: Add the sparkle and give effect

let's add sparkle and change the blending yo screen.

9.PNG 580.7 KB
then add a mask and convert to invert the layer and select brush tool.
set foreground color is white and creates an effect in the main object after creating effect open blending mode and create a level and click on create clipping mask and set property per requirement.
then open blending mode and select color lookup and set 3dlutfile to crisp_warm: look and set opacity as per requirement.
now finally ready to glow effect

10.png 473.57 KB
September 10, 20202 minutesauthorKishan Savaliya


You can only develop products and services that are very effective if you pay attention to the needs of your customers and prospects. One way to understand exactly what your customers want is through research and surveys.

1. Understand your customers

You can only develop products and services that will be a big hit if you pay attention to the needs of your customers and prospects. One way to understand exactly what your customers want is through research and surveys. You should constantly invite them to give honest, brutal feedback.

Reviews and surveys are the best way to get into the minds of your customers. This makes it easier for you to develop products and services that are appropriate to the current demands of the market. Moreover, it helps you understand the area in which your company needs to improve.

2. Improving customer service

If you do not provide quality customer service, it will be difficult to satisfy your customers even if you have an excellent product or service. This aspect of the business is about taking extra steps to make them feel special. Let your customers know that they have value. If they have a problem, make sure you address them immediately. If they have questions, take the time to answer.

They should not feel that things are difficult for them if they raise specific issues. Social media is the best way to listen to and understand your customers. If they find customer service satisfactory, they may also recommend buying others from your business.

3. Establish loyalty

It takes time to encourage customers to come and buy what you offer. But just buying them is not enough. You need to promote loyalty. Considering there are other competitors who can offer them better, you want them to stay loyal to you. Don’t be satisfied just because you already have a lot of loyal customers.

They can easily be attracted to other options and they can leave you. Provide loyalty rewards. If there are discounts and discounts, let these most loyal customers be the first to know. You must make sure your customers know they are appreciated.

4. Focus on professional development

The success of your business also depends on the quality of the employees you hire. Building an effective team is the key to making sure your business grows.

One of the best ways to motivate hardworking employees is to give them a sense of purpose. They should not feel that they have to work just to work.

5. Understand your customers

Find ways to increase the sales of your existing customers It's much cheaper than finding a new one. Even if you can't expand your product line, you can still sell more of your existing product or service to a client you already have. An easy way to do this is by volume discount.

6. Participate in networking events

Take the time to build your networks - it's not what you know but who you know. Networking allows you to build relationships with other people and encourage customers to refer to you through words.

7. Give back to your community

Creating brand awareness in your local community is a great way to attract new business. Consider participating in a sponsorship or community event to enhance your business profile.

We will see more points in our next tutorial.

September 07, 20203 minutesauthorAnkit Kalathiya
Most of the developers are facing select2 styles removing issue when livewire render the component.

We can resolve this issue by using a livewire javascript hook.

Here is my screen with select2 before livewire component rendering.
select2-before-livewire-render.png 37.21 KB

And when the livewire component is refreshed means re-render the select2 style is gone ☹️

select2-after-renrering-livewire-component.png 62.48 KB

How to Fix it ?? 🤔

Well you just need to add some JQuery code to your livewire component. here we are going to use afterDomUpdate webhook of livewire. add following code to your livewire component :

document.addEventListener('livewire:load', function (event) {
    window.livewire.hook('afterDomUpdate', () => {

livewire:load is listening events when livewire component is load and we can add our code within it.

And now when your livewire component is refreshed your select2 style will be still there as we are again applying it.

Other Livewire Posts :

Stay tuned to us for more interesting stuffs about livewire. 

September 03, 20201 minuteauthorVishal Ribdiya