Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get unique values in laravel

$users = User::select('name')->distinct()->get();
Comment

get the unique rows from table laravel

$categories = Machine::distinct('category')->pluck('category');


Comment

unique data from eloquent laravel

$users = DB::table('users')
            ->select('id','name', 'email')
            ->groupBy('name')
            ->get();
Comment

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);
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: migration make 
Php :: yii2 activeform adding field placeholder 
Php :: fecade Artisan:call laravel 
Php :: Google Dorks Using special search string to find vulnerable websites: 
Php :: terug tellende for loop php 
Php :: php delete item from array 
Php :: remove get parameters from url php 
Php :: add a new column to existing table in a migration 
Php :: set null on foreign key deletion in laravel 
Php :: laravel custom error page 
Php :: stream_set_blocking 
Php :: php get version 
Php :: laravel blade short if 
Php :: forelse laravel 
Php :: how check if method is not in class in php 
Php :: laravel make model and migration 
Php :: get file name from file path in php 
Php :: php array continued 
Php :: laravel before migration 
Php :: woocommerce if it is shop page remove breadcrumbs 
Php :: codeigniter count rows 
Php :: Redirect image attachment pages in Wordpress 
Php :: get the unique rows from table laravel 
Php :: woocommerce change sale text 
Php :: laravel eloquent get only field name 
Php :: php home url 
Php :: php iterate through array 
Php :: php subtract seconds from datetime 
Php :: how count the rout in route.php laravel 
Php :: Add 2 hours to current time in cakephp 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =