$list = TableName::where('user_id', 'user_001'
->groupBy('user_id')
->groupBy('subscription_id')
->select('user_id','subscription_id','type')
->selectRaw('GROUP_CONCAT(holiday) as holidays')
->get();
use Illuminate\Support\Facades\DB;
$sql = 'SELECT GROUP_CONCAT(holiday) as holidays, user_id,subscription_id, type FROM TableName
where vendor_id = 'user_001' GROUP BY user_id, subscription_id;';
$list = DB::select($sql, []);
create table department(
id int auto_increment primary key,
nameD varchar(255) not null unique,
managerID int not null) ENGINE InnoDB
foreign key(managerID) references employee(id)) ENGINE InnoDB
create table employee(
id int auto_increment primary key,
name varchar(255) not null unique,
departmentID int not null,
foreign key(departmentID) references department(id)) ENGINE InnoDB