how to do substring inside query if the name are kevin_001
User::where(substr('name', 0, strpos('name', '_'), '=', 'kelvin');
you can use DB::raw
method for this:
User::where(DB::raw("substr('name', 1, strpos('name', '_'))"), '=', 'kelvin');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community