lundi 21 juin 2021

how to sort data including special characters in laravel in composer

how to sort data including special characters in laravel

like 332-1 , 332-2 , 332-10 , 332-11 , 332-20

when try to sort

got

332-1 , 332-10, 332-11,332-2, 332-20

   $data = GeneralVehicle::with('pricingVehicle', 'watermarkVehicle')
        ->where('save_check', '!=', 2)
        ->where('hidden_check', 0);
    if ($transit != 0)
        $data->where('selection', 2)
            
            ->orderBy('lot_no', 'asc');
    else
        $data->whereIn('selection', [1, 3, 5])
            ->orderBy('lot_no', 'desc');
    if ($location != 0)
        $data->where('location', $location);
    else
        $data->whereIn('location', [1, 2, 3]);
    if ($category != 0)
        $data->where('category', $category);
    $vehicles_total = $data->get();
    $vehicles = $data->paginate(20);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire