Hello @kartik,
You can use relations as query builder to fetch the results as:
$assignment_details = $assignment->raw_plan()
->select(DB::raw('group_concat(name) as names'))
->where('assignment_id', 1)
->groupBy('flag')
->get();
Use table_name.* in select to get all the fields.
$assignment_details = $assignment->raw_plan()
->select('raw_plans.*', DB::raw('group_concat(name) as names'))
->where('assignment_id', 1)
->groupBy('flag')
->get();
Hope it helps!!
Thank you!!