Found 51 Articles for Laravel

How to check if a Laravel collection is empty?

Shilpa Kalangutkar
Updated on 29-Aug-2022 08:52:14

17K+ Views

Before we answer the above question, let us first understand what collections are in Laravel. Collection in Laravel is an API wrapper that helps you deal with different operations to be performed on arrays. It makes use of the class Illuminate\Support\Collection to deal with arrays in Laravel. To create a collection from a given array you need to make use of the collect() helper method that returns a collection instance. Later you can use a chain of methods like converting to lowercase and sorting on the collection instance. Example  The example in this section demonstrates how to create a collection from ... Read More

Advertisements