1

I add jenssegers Laravel-MongoDB package into my Laravel 4.2 project, and have a one problem. Maybe can help me. I cann't use DB::raw in select or get method. I need to change name of select column and add columns into one column, but Laravel return me an error. I try to do something like this:

$arr = StudentMark::join('students', 'students.id','=','student_marks.student_id')
        ->select(array('student_marks.id',DB::raw('CONCAT(students.name, " ",
students.surname, " (", students.index,") ") AS student')))->get();

But Laravel return me an error:

{"error":{"type":"ErrorException","message":"Illegal offset type","file":".....vendor\\jenssegers\\mongodb\\src\\Jenssegers\\Mongodb\\Query\\Builder.php","line":240}}

Can anybody help me?

Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39
mrakodol
  • 1,143
  • 3
  • 12
  • 41

1 Answers1

-1

I use select with columns, and concating columns do in foreach of results and then return to client, and that solve me a problem. :)

mrakodol
  • 1,143
  • 3
  • 12
  • 41