for now have like this:
$values = DB::table('clients')
->select('*')
->whereNull('deleted_at')
->where('user_id', Auth::user()->id)
->where(function ($query) {
$query->where('company_name', 'LIKE', "%".$_GET['search']['value']."%")
->orWhere('first_name', 'LIKE', "%".$_GET['search']['value']."%")
->orWhere('last_name', 'LIKE', "%".$_GET['search']['value']."%");
})
->orderBy($order_by, $order_dir);
but getting bad query like this..
select * from `clients` where `deleted_at` is null and `user_id` = 1 and (`company_name` LIKE "%diz%" or `first_name` LIKE "%diz%" or `last_name` LIKE "%diz%") and (`id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%") order by `group_id` asc, `id` asc limit 10 offset 0
And can't figure out from where query getting part:
and (`id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%" or `id` LIKE "%diz%")
I need to get query something like this:
select * from `clients` where `deleted_at` is null and `user_id` = 1 and (`company_name` LIKE "%diz%" or `first_name` LIKE "%diz%" or `last_name` LIKE "%diz%") order by `group_id` asc, `id` asc limit 10 offset 0
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire