Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel Collection Get Unique Values

<?php
  
namespace AppHttpControllers;
  
class ITSController extends Controller
{
    /**
     * Write code on Method
     *
     * @return response()
     */
    public function index()
    {
        $data = [1,2,4,5,3,2,2,4,5,6,8,9];
  
        $data  = collect($data)->unique();
  
        dd($data);
    }
}
Source by www.itsolutionstuff.com #
 
PREVIOUS NEXT
Tagged: #Laravel #Collection #Get #Unique #Values
ADD COMMENT
Topic
Name
3+2 =