DB::statement(); for serial in table

DB::statement(DB::raw('set @serial=0'));

$list = Designation::orderBy('id','desc')
         ->get([
         'id',
         'title',
         DB::raw('@serial := @serial +1 as serial')
          ]);

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine