This is the method syntax getSubstringExpression($string, $start, $length = null)
It is part of doctrine, not laravel (through eloquent is built on top of doctrine)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I need to create a substring(field, 0, -10) to keep only last 10 chars of a string.
I am using a raw query here because i need to do a lower(field) LIKE
this because i am using both mysql and postgres (some customers have mysql and others postgres).
I remember there was a system to use "getSubstringExpression()" of laravel, that is automatically passed to specific grammar of current connection
i tried
... ->query()->getSubstringExpression()
DB::raw()->getSubstringExpression()...
I have no idea of how to use getExpression s
Please or to participate in this conversation.