@tag Did you try this?
->whereRaw("(CONCAT(clans.name,' ',ibf_members.members_display_name) like '%?%')",$searchString);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this query:
$query = DB::table('clan_teams')
->select('clans.name', 'ibf_members.members_display_name')
->leftJoin('clans', 'clan_teams.clan_id', '=', 'clans.id')
->leftJoin('ibf_members', 'clans.leader_id', '=', 'ibf_members.id')
->whereRaw("(CONCAT(clans.name,' ',ibf_members.members_display_name) like '%:search%')")
->get();
The purpose of the CONCAT statement at the bottom is to create a simple multi-faceted searchable string, but I need to parameterize the actual search string I use so that it's safe from SQL injection.
But I can't find any information on how to do this with the query builder. Do I have to do a completely raw query?
Please or to participate in this conversation.