Skip to main content
adicionou 114 caracteres ao conteúdo
Fonte Link
novic
  • 36,7mil
  • 4
  • 32
  • 70

Basicamente com Query Builder:

$dictionaries = DB::table('dictionaries')
          ->select(DB::raw('dictionaries.name, 
 GROUP_CONCAT(CONCAT('"{"namename:"'", dictionary_files.name, '"file"file:"'",dictionary_files.path,'"}'")) as files'))
          ->where('dictionary_files.name', 'LIKE', "Teste%")
          ->groupBy('dictionaries.name')
          ->get();

Observação: tinha também concatenção errada, aspas fora do lugar, mas, com Query Builder vai resolver seu problema.

Referencias

Basicamente com Query Builder:

$dictionaries = DB::table('dictionaries')
          ->select(DB::raw('dictionaries.name, 
 GROUP_CONCAT(CONCAT('{"name:"', dictionary_files.name, '"file:"',dictionary_files.path,'}')) as files'))
          ->where('dictionary_files.name', 'LIKE', "Teste%")
          ->groupBy('dictionaries.name')
          ->get();

Basicamente com Query Builder:

$dictionaries = DB::table('dictionaries')
  ->select(DB::raw('dictionaries.name, GROUP_CONCAT(CONCAT("{name:",dictionary_files.name,"file:",dictionary_files.path,"}")) as files'))
  ->where('dictionary_files.name', 'LIKE', "Teste%")
  ->groupBy('dictionaries.name')
  ->get();

Observação: tinha também concatenção errada, aspas fora do lugar, mas, com Query Builder vai resolver seu problema.

Referencias

Fonte Link
novic
  • 36,7mil
  • 4
  • 32
  • 70

Basicamente com Query Builder:

$dictionaries = DB::table('dictionaries')
          ->select(DB::raw('dictionaries.name, 
GROUP_CONCAT(CONCAT('{"name:"', dictionary_files.name, '"file:"',dictionary_files.path,'}')) as files'))
          ->where('dictionary_files.name', 'LIKE', "Teste%")
          ->groupBy('dictionaries.name')
          ->get();