Kirankumar Kirankumar - 1 year ago 171
Javascript Question

Replace double quote with single quote using laravel select query

I am using laravel to get data from my database
where i required to get the instruction with single quote
Means wants to replace double quote with single quote wherever the double quote is used.
I am new to laravel, i know query structure of MySql and understanding laravel so any suggestion will be helpful for me.


An example of MySql Query is as below, I wants something like this in laravel

select replace(col_instruction,'"',"'") from mytable


According to the documentation, this should work:

$result = DB::table('mytable')->select(DB::raw('replace(col_instruction, \'"\',"\'")'))->get();