Here is the code :
foreach ($test_scores as $score) {
switch ($score['name']) {
case 'LE-TOD':
$le_tod = $score['banding'];
$le_tod_desc = $score["result_desc"];
if($score['std_score'] == 0) {
$le_tod_small = $scoring['tod']['no_pref_bottom'];
}
else {
$le_tod_small = $scoring['tod']['pref_bottom'].$score['banding'];
}
break;
This is where I get the error message :
public static function generateLSPReportFile($dataInput, $auto_download = true)
{
$file_type = $dataInput['file_type'];
$test_type_id = $dataInput['test_type_id'];
$he_she = array('male' => 'He', 'female' => 'She');
$his_her = array('male' => 'his', 'female' => 'her');
$candidate = \Candidate::where('id',$dataInput['candidate_id'])->first();
if(!$candidate)
return;
$candidate = $candidate->toArray();
$candidate_name = $candidate['first_name'].' '.$candidate['last_name'];
$order = \Order::with('client')->find($dataInput['order_id']);
if(!$order)
return;
$client = $order->client;
$order = $order->toArray();
//for test dates
$order_candidate = \OrderCandidate::candidateId($dataInput['candidate_id'])->orderId($dataInput['order_id'])->first()->toArray();
$order_tests = \OrderCandidateTest::orderCandidateId($order_candidate['id'])
->status(\Config::get('kcg.candidate_test_status_taken'))
->testId($dataInput['test_id'])
->with(array('test' => function($query){
$query->select(['id', 'name', 'description', 'abbreviation']);
}));
$tests_scores = \OrderCandidateTestScore::orderId($dataInput['order_id'])
->candidateId($dataInput['candidate_id'])
->testId($dataInput['test_id'])
->with(array('test' => function($query){
$query->select(['id', 'name', 'description', 'test_type_id']);
}));
$test_type = TestType::find($test_type_id);
$test_scores = $tests_scores->orderBy('sequence_no')->get()->toArray();
$order_tests = $order_tests->get()->toArray();
if(!$order_tests)
return;
if(!$tests_scores)
return;
It posted an error : ErrorException Undefined offset: 2. I'm really not sure what's causing this.
What am I doing wrong here? Please help me. Thank you