Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shanukk's avatar

How to convert mysql query to laravel

I have a mysql query

      $sql="SELECT *from table where `Content`->>'$.cycle_id'=1";

How can i convert this query to laravel?Any help would be appreciated.

0 likes
1 reply
spekkionu's avatar

I'm not sure the ->> operator is supported by eloquent. You might have to use DB::raw for that part.

DB::table('table')->where('Content->cycle_id', 1)

OR

DB::table('table')->whereRaw("Content->>'$.cycle_id' = 1")

Please or to participate in this conversation.