Exemplo n.º 1
0
 public function deletePayementRequest($id)
 {
     if (Auth::user()->type == 'tutor') {
         TutorPaymentRequest::where(['id' => $id, 'tutorid' => Auth::user()->id])->delete();
         return redirect()->route('tutor.paymentrequest')->with('msg', 'successfully deleted request');
     } else {
         return '404 page not found';
     }
 }
Exemplo n.º 2
0
 public function postTutorPaid(Request $request)
 {
     if (Auth::user()->type == 'admin') {
         $tutorpayment = TutorPaymentRequest::where(['id' => $request->input('tutorid')])->first();
         $balance = $tutorpayment->tutor->balance->balance - $tutorpayment->payment;
         Balance::where(['userid' => $tutorpayment->tutor->id])->update(['balance' => $balance]);
         Transaction::create(['senderid' => Auth::user()->id, 'transactionid' => $request->input('transactionid'), 'amount' => $tutorpayment->payment, 'recipientid' => $tutorpayment->tutorid]);
         TutorPaymentRequest::where(['id' => $request->input('tutorid')])->delete();
         return redirect()->route('admin.turorpayment')->with('msg', 'Successfully Paid');
     } else {
         return '404 page not found';
     }
 }