title: ErrorException Trying to get property of non-object
body: <p>Hi here I got these following errors:</p>
  
  <pre><code>at HandleExceptions-&gt;handleError(8, 'Trying to get property of non-object', 'C:\\wamp64\\www\\gesetud\\app\\Http\\Controllers\\FeeController.php', 99, array('viewName' =&gt; 'fee.payment', 'student_id' =&gt; '4', 'feetypes' =&gt; object(Collection), 'status' =&gt; null))in FeeController.php (line 99)
  
  at FeeController-&gt;payment('fee.payment', '4')in FeeController.php (line 124)
  </code></pre>
  
  <p>when using this Route </p>
  
  <pre><code>Route::get('/etudiant/aller/a/payement/{student_id}',['as'=&gt;'goPayment','uses'=&gt;'FeeController@goPayment']);
  </code></pre>
  
  <p>here the 'goPayment' method line 124:</p>
  
  <pre><code> public function goPayment($student_id)
  {
      return $this-&gt;payment('fee.payment',$student_id);
  }
  </code></pre>
  
  <p>And here line 99 is $programs=Programme::where....:</p>
  
  <pre><code> public function payment($viewName,$student_id)
  {
      $feetypes = FeeType::all();
      $status = $this-&gt;student_status($student_id);
      $programs = Programme::where('program_id',$status-&gt;program_id)-&gt;get();
      $levels = Niveau::where('program_id',$status-&gt;program_id)-&gt;get();
      $studentfee = $this-&gt;show_school_fee($status-&gt;level_id)-&gt;first();
      $readStudentFee = $this-&gt;read_student_fee($student_id)-&gt;get();
      $readStudentTransaction = $this-&gt;read_student_transaction($student_id)-&gt;get();
      $receipt_id = ReceiptDetail::where('student_id',$student_id)-&gt;max('receipt_id');
      return view($viewName,compact('programs',
                                      'levels',
                                      'status',
                                      'studentfee',
                                      'receipt_id',
                                      'readStudentFee',
                                      'readStudentTransaction',
                                      'feetypes'))
                                      -&gt;with('student_id',$student_id);
  </code></pre>