Laravel where like not working properly
I think your string concatenation is wrong.
Try to change where statement to
where('clubs.name', 'LIKE', '%' . $query. '%')
Try this
$Clubs = Club::where(DB::raw('LOWER(clubs.name)'), 'LIKE', '%'.strtolower($query).'%')->Join('leagues', 'clubs.league_id', '=', 'leagues.id')->select('clubs.id', 'clubs.name', 'clubs.blason', 'leagues.name as league_name')->orderBy('clubs.name')->get();
check now:
public function listall($query) {
dd( $query );$clubs = Club::join('leagues', 'clubs.league_id', '=', 'leagues.id')->where('clubs.name', 'LIKE', '%' . $query . '%')->select('clubs.id', 'clubs.name', 'clubs.blason', 'leagues.name as league_name')->orderBy('clubs.name');dd( $clubs->toSql() );return Response::json($clubs);
}