Thursday, March 2, 2017

how can I fetch the Ids from one table to another using the DashboardController and js

i've two tables;

exam_Marks table

{id, codeid, examMarks}

examCodes table

{id, codes, codeDesc}

am trying to fetch the id of codes from table examCodes and pass them to exam_marks table, however I can't earn this and i don't know where the problem is. can anyone please help or advice me to use another method

this is my app.js

$scope.examcodesList = function(){
    dataFactory.httpRequest('dashboard/examcodeList','POST',{},{"classes":$scope.form.codes}).then(function(data) {
      $scope.subje = data.subje;
    });
  }

and this is my DashboardController.php

public function examcodesList(){
        $examcodesList = array();


            if(!Input::has('classes')){
                return $examcodesList;
            }
            $classes = Input::get('classes');


        if(is_array($classes)){
            return examcodes::whereIn('id',$classes)->get()->toArray();
        }else{
            return examcodes::where('id',$classes)->get()->toArray();
        }
    }




via Wisse Denis

Advertisement