There seems to be a space behind url . If you remove the space it should work as expected ;)
$monitorsQuery->where('url', 'LIKE', '%' . $query . '%')
Otherwise, there might be another issue.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I have the below query which is not working for me. When I search for a string I sometimes get results back. I'm 100% sure by columns exist and the data si there. It seems that only results where the alias matches is working correctly for me.
public function index()
{
$query = request('q');
$itemsQuery = Item::query()
if ($query !== null) {
$monitorsQuery->where('url ', 'LIKE', '%' . $query . '%')
->orWhere('alias', 'LIKE', '%' . $query . '%');
}
$items = $itemsQuery->orderBy('alias')->paginate(self::PER_PAGE);
}
Does anybody understand what the problem could be?
There seems to be a space behind url . If you remove the space it should work as expected ;)
$monitorsQuery->where('url', 'LIKE', '%' . $query . '%')
Otherwise, there might be another issue.
Please or to participate in this conversation.