public function postGetClassStreamPair() { $classes = Classes::where('school_id', '=', $this->getSchoolId())->orderBy('class', 'asc')->get(); $i = 0; $stream_Class_Pairs = array(); foreach ($classes as $class => $value) { $stream = Streams::find($classes[$class]['streams_id']); $stream_Class_Pairs[$i] = array('classes_id' => $classes[$class]['id'], 'streams_id' => $classes[$class]['streams_id'], 'stream_class_pair' => $classes[$class]['class'] . " (" . $stream->stream_name . ")"); $i++; } $response = array('status' => 'success', 'result' => array('stream_class_pairs' => $stream_Class_Pairs)); return Response::json($response); }