How to write this Query in Laravel?
SELECT
a.id, a.name, a.email, a.role, a.percentage, a.remaining_tax, a.min_peoples_per_table ,a.regions,
GROUP_CONCAT( r.name SEPARATOR ", ") as regions_name
FROM administrator as a
INNER JOIN regions as r
ON a.regions REGEXP CONCAT("[[:<:]]", r.id, "[[:>:]]")
GROUP BY a.id
ORDER BY a.id desc;
Code under construction:
$list = DB::table('administrator as a')
->select("a.id" , "a.name", "a.email", "a.role", "a.percentage", "a.remaining_tax", "a.min_peoples_per_table" ,"a.regions")
->groupBy("a.id")
->orderBy("a.id", "desc")
->get();
return $list;
In the part of GROUP_CONCAT and JOIN I'm kind of lost.