Kirankumar Kirankumar - 7 months ago 94
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.

Edited

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

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

Answer

According to the documentation, this should work:

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