Skip to content
October 20, 2026
Newsletter
Random News
TechRadiant

TechRadiant

Your Destination for Tech News, Reviews, AI News and AI Articles

  • AI
  • Javascript
  • React
  • Bash
  • Git
  • Magento
  • Mysql
  • Redis
  • Frontend
  • Backend
    • PHP
    • Laravel
    • Redis
  • Home
  • php
  • Page 9

Tag: php

  • Laravel

How to get a random item from Laravel Collection?

Techradiant4 years ago4 years ago01 mins

< 1 min readTo get a random item from a Laravel collection, you can use the random method. This method will return a random element from the collection, or null if the collection is empty. Here’s an example: You can also pass a number as an argument to the random method to get that number of random elements…

Read More
  • Laravel

How to calculate the minimum value in Laravel collection?

Techradiant4 years ago4 years ago01 mins

< 1 min readTo calculate the minimum value in a Laravel collection, you can use the min method. This method will return the minimum value of the items in the collection. Here’s an example: You can also pass a callback to the min method to specify a custom comparison function: If you want to calculate the minimum value…

Read More
  • Laravel

How to get the maximum value of a given key in Laravel collection?

Techradiant4 years ago4 years ago02 mins

< 1 min readTo get the maximum value of a given key in a Laravel collection, you can use the max method. This method will return the maximum value of the items in the collection based on a given key. Here’s an example: You can also pass a callback to the max method to specify a custom comparison…

Read More
  • Laravel

How to get the last item in Laravel collection?

Techradiant4 years ago01 mins

< 1 min readTo get the last item in a Laravel collection, you can use the last method. This method will return the last element of the collection, or null if the collection is empty. Here’s an example: You can also pass a callback to the last method to get the last element that matches a certain condition:…

Read More
  • Laravel

How to check if a collection is empty in Laravel?

Techradiant4 years ago01 mins

< 1 min readTo check if a Laravel collection is empty, you can use the isEmpty method. This method will return true if the collection is empty, and false if it is not. Here’s an example: You can also use the isNotEmpty method, which is the opposite of the isEmpty method and will return true if the collection…

Read More
  • Laravel

How to check if a key exist in Laravel collection?

Techradiant4 years ago02 mins

< 1 min readTo check if a key exists in a Laravel collection, you can use the has method. This method will return true if the key exists in the collection, and false if it doesn’t. Here’s an example: You can also use the offsetExists method, which is an alias of the has method: Note that the has…

Read More
  • Laravel

How to flip keys with values in Laravel collection?

Techradiant4 years ago4 years ago01 mins

< 1 min readTo flip the keys with the values in a Laravel collection, you can use the flip method. This method will create a new collection with the keys and values swapped. Here’s an example:

Read More
  • Laravel

How to get the first element of a collection in Laravel?

Techradiant4 years ago02 mins

< 1 min readTo get the first element of a Laravel collection, you can use the first method. This method will return the first element of the collection, or null if the collection is empty. Here’s an example: You can also pass a callback to the first method to get the first element that matches a certain condition:…

Read More
  • Laravel

How to find duplicates in Laravel collection?

Techradiant4 years ago4 years ago04 mins

2 min readTo find duplicates in a Laravel collection, you can use the duplicates() method. The duplicates method retrieves and returns duplicate values from the collection: For Example: If the collection contains arrays or objects, you can pass the key of the attributes that you wish to check for duplicate values: You can also find duplicates in a Laravel…

Read More
  • Laravel

How to count the total number of items in a Collection in Laravel?

Techradiant4 years ago4 years ago02 mins

< 1 min readTo count the total number of items in a Laravel collection, you can use the count method. This method will return the number of items in the collection. Here’s an example: You can also use the size method, which is an alias of the count method: If you want to count the number of items…

Read More
  • 1
  • …
  • 7
  • 8
  • 9
  • 10
  • 11
  • …
  • 17

Sponsored

  • Top 5 Plugins to Install in Claude Code
  • Top 12 AI Video Generators in 2026 (Compared by Use Case)
  • How to Push a Docker Image to Docker Hub (Step-by-Step Guide)
  • Meet Jev: The AI Model That Makes Decisions Instead of Sentences
  • How to use Claude Code for Free?
TechRadiant 2026. Powered By BlazeThemes.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT