process: from the student registration (enroll) page (figure 3) should be able to check whether student paid or not, if not paid Pay button should be visible. else display PAID message.
to do the above process I should check the enroll table (figure 1) student id with payment table (figure 2) student id ,
index controller code:
public function index()
{
$enrolls = Enroll::where('is_paid_admission',1)->orderBy('id','DESC')->get();
$payments = DB::table('payments')
->join('enrolls','payments.enroll_id','=', 'enrolls.id')
->where('payments.student_id','=','enrolls.student_id')
->get();
return view('enroll.index',compact('enrolls','payments'));
}
ERROR Message shows :
ErrorException (E_ERROR)
Property [student_id] does not exist on this collection instance. (View: C:\wamp64\www\SRVSYS2021\resources\views\enroll\index.blade.php)
Previous exceptions
Property [student_id] does not exist on this collection instance. (0)
INDEX Page Code if condition:
@if ( $enroll->student_id == $payments->student_id )
<td> </td>
@else
<td><a href="" class="btn btn-info btn-xs" role="button"> <i class="fa fa-money"> PAY </i></a></td>
@endif
(All the details have been attached below)
figure 2: payments table
figure 3: page view of enroll table
I hope you can understand my question. please give me your valuble ideas to solve this problem
QUESTION: I want to compare the student_id on ENROLL_TABLE & PAYMENT_TABLE, and show the payment button if not paid. (payment table only store if the student paid only) whatever the possible answer appreciate
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire