dimanche 15 novembre 2020

Why doesn't it correctly filter items in a hasOne Laravel relation using spaces blanks

I have a relationship defined in laravel - Warehouse - Product, when I search for text strings to compare with the product description, and I add spaces it does not filter correctly.

This I tried and Other question. but it doesn't filter me correctly

Warehouse::whereHas('item', function($query) use($search,$column) {
    //$query->whereRaw(DB::raw("LOWER(REPLACE(description, ' ', ''))  LIKE CONCAT('%',LOWER(REPLACE('".$search."', ' ', '')), '%')" ));
    // $search = 'la es';
    $query->where( $column, 'LIKE','%'.str_replace(' ', '', $search).'%');
})
->orderBy('item_id')
->get()


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire