dimanche 26 avril 2020

How to get text Strings order in Laravel project

I would like to sort column like orderBy.

'WC' columns has such data

'AB-1' 'AB-2' 'AB-5' 'AB-300' 'AB-1980' .... etc

Front of "AB-" letter is same. then comes number.

Could you teach me how to write code please?

 public function index()
    {
        $images = ImageGallery::orderBy('wc', 'asc')->get();
        return view('image-gallery',compact('images'));
    }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire