Generate QR Code In PHP

For any developer knowing how to generate dynamic QR codes and allow users to download them as image files is an important task. QR codes are playing an important role in many industries like online payments, eCommerce, or ticket booking. Nowadays sharing QR codes on visiting cards is also very common. The QR code stores

Learn More

Check File Exists or not Using PHP

While working with file download functionality with the database, we commonly face an error that says file not found. So if we add functionality to check file exists or not before the actual searching file then we can provide a better user experience. PHP provides many built-in functions to handle file operations easily. Some of

Learn More

Check Database Connection in Laravel

In this example, we will check the database connection in Laravel. Before starting to create a new Laravel application start your database services like XAMPP or WAMPP and change database credentials in the .env file. Here, we will check database is connected and get an active database name using DB helper. To check database exists

Learn More

Get SQL Query in Laravel

Sometimes we face issues in getting data or getting the wrong data. We can resolve this type of issue using row SQL queries but for that, we need to convert the eloquent queries into row queries. Laravel provides two ways to get row queries. Using Laravel Eloquent methods This method to get the query of

Learn More

Create Custom Method In Laravel Model

Working with dates, we need to display formatted dates to users and store dates in the database in a specific format. Laravel provides a few ways to implement this functionality like an accessor by defining a custom function or by converting the date every time. For this example, we will define the accessor function into

Learn More

Delete All Data From Eloquent Model

Sometimes we need to delete all the data from a table. Some tables are just to store temporary data. So we need to delete or empty the table using a specific time or event. Laravel or Eloquent has many methods from query to static from removing all records from the table like DB class with

Learn More

How to Check Collection Is Empty or not in Laravel?

The common data storage method in Laravel is collection. The Collection class allows you to chain its methods to perform fluent mapping and reduce the underlying array. It provides most methods like array methods. There are many methods to check whether the collection is empty or not with examples. Let’s know more about them one

Learn More

How to Convert Collection Into JSON In Laravel

Laravel uses collection classes as common data storage. But while creating APIs JSON is an idle data type to return response data instead of a collection. In this tutorial, you will learn how to convert collection data into JSON strings. Those data can be a model instance or even a manually created collection. We will

Learn More

How to Customize Laravel Request Validation Response?

In every application, data validation before executing further logic is required. Laravel provides an easy way to implement data or user input validation using its validator methods. Laravel has a special request class concept for validation. Which separate validation logic and actual logic. But sometimes working with Laravel request validation class, we need to return

Learn More