简体   繁体   中英

ErrorException Trying to get property of non-object

Hi here I got these following errors:

at HandleExceptions->handleError(8, 'Trying to get property of non-object', 'C:\\wamp64\\www\\gesetud\\app\\Http\\Controllers\\FeeController.php', 99, array('viewName' => 'fee.payment', 'student_id' => '4', 'feetypes' => object(Collection), 'status' => null))in FeeController.php (line 99)

at FeeController->payment('fee.payment', '4')in FeeController.php (line 124)

when using this Route

Route::get('/etudiant/aller/a/payement/{student_id}',['as'=>'goPayment','uses'=>'FeeController@goPayment']);

here the 'goPayment' method line 124:

 public function goPayment($student_id)
{
    return $this->payment('fee.payment',$student_id);
}

And here line 99 is $programs=Programme::where....:

 public function payment($viewName,$student_id)
{
    $feetypes = FeeType::all();
    $status = $this->student_status($student_id);
    $programs = Programme::where('program_id',$status->program_id)->get();
    $levels = Niveau::where('program_id',$status->program_id)->get();
    $studentfee = $this->show_school_fee($status->level_id)->first();
    $readStudentFee = $this->read_student_fee($student_id)->get();
    $readStudentTransaction = $this->read_student_transaction($student_id)->get();
    $receipt_id = ReceiptDetail::where('student_id',$student_id)->max('receipt_id');
    return view($viewName,compact('programs',
                                    'levels',
                                    'status',
                                    'studentfee',
                                    'receipt_id',
                                    'readStudentFee',
                                    'readStudentTransaction',
                                    'feetypes'))
                                    ->with('student_id',$student_id);

here student_status function:

public function student_status($studentId)
{
    return Status::latest('statuses.status_id')
            ->join('students','students.student_id','=','statuses.student_id')
            ->join('classes','classes.class_id','=','statuses.class_id')
            ->join('academics','academics.academic_id','=','classes.academic_id')
            ->join('shifts','shifts.shift_id','=','classes.shift_id')
            ->join('times','times.time_id','=','classes.time_id')
            ->join('groups','groups.group_id','=','classes.group_id')
            ->join('batches','batches.batch_id','=','classes.batch_id')
            ->join('levels','levels.level_id','=','classes.level_id')
            ->join('programs','programs.program_id','=','levels.program_id')
            ->where('students.student_id',$studentId)
            ->first();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM