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