Laravel: columnize () must have an array type, a given row, called in

I want to call this request instead of ID when updating the record, but im getting the error message columnize () should be from an array of types, the string specified in

$user = Attendances::find(DB::raw('concat (firstname, " ",lastname)'), 'like', Input::get('student_name'))->where('section_name', 'like', Input::get('section_name'))->where('teacher_id', '=', Auth::user()->id)->where('subject_code', 'like', Input::get('subject_code'));

Help for help: (

+4
source share
1 answer

The first method should be where(), since it find()works only with primary keys. Also at the end you need to call get()or first()to execute the request:

$user = Attendances::where(DB::raw('concat (firstname, " ",lastname)'), 'like', Input::get('student_name'))
       ->where('section_name', 'like', Input::get('section_name'))
       ->where('teacher_id', '=', Auth::user()->id)
       ->where('subject_code', 'like', Input::get('subject_code'))
       ->first();
+3
source

All Articles