You should group your search LIKE
query here
Order::with(
[
'customer',
'laundry',
'driver',
'driver.user',
'progresses' => function($p) {
$p->orderby('created_at', 'asc');
},
'progresses.progress',
'services'
]
)->where('user_id', $user->id)
->where(function($q) {
$q->where('id', 'like', '%'.$this->search.'%')
->orWhere('transport', 'like', '%'.$this->search.'%')
->orWhere('amount', 'like', '%'.$this->search.'%')
->orWhere('weight', 'like', '%'.$this->search.'%')
->orWhere('total', 'like', '%'.$this->search.'%');
})->paginate(10);
So the query string is look like:
WHERE user_id = ?
AND
(id LIKE ? OR transport LIKE ? OR amount LIKE ? OR weight LIKE ? OR total LIKE ?)
It will ignore the where('user_id', '=', $user->id)
because of orWhere
on your search LIKE
query
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…