PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` where('id', $request->reference_id)->first(); $total_with = ReferenceWithdraw::where('reference_id', $request->reference_id)->sum('amount'); $total_bal = \App\ReferenceIncome::where('reference_id', $request->reference_id)->sum('amount'); return view('withdraw.create', compact('reference', 'total_with', 'total_bal')); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate([ 'amount' => 'required', 'date' => 'required', ]); $wth = new ReferenceWithdraw(); $wth->amount = $request->amount; $wth->reference_id = $request->reference_id; $wth->date = $request->date; $wth->save(); $ref = \App\Reference::where('id', $request->reference_id)->first(); $to = $ref->mobile; $message = "Dear" . $ref->name . ", You have withdrawn amount of " . $wth->amount . " TK"; event(new SendSMS($to, $message)); Toastr::success('Withdraw Created ! :)', 'Success'); return redirect()->route('admin.withdraw.index'); } /** * Display the specified resource. * * @param \App\ReferenceWithdraw $referenceWithdraw * @return \Illuminate\Http\Response */ public function show(ReferenceWithdraw $referenceWithdraw) { // } /** * Show the form for editing the specified resource. * * @param \App\ReferenceWithdraw $referenceWithdraw * @return \Illuminate\Http\Response */ public function edit($id) { $rwth = ReferenceWithdraw::findOrFail($id); return view('withdraw.edit', compact('rwth')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\ReferenceWithdraw $referenceWithdraw * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $rwth = ReferenceWithdraw::findOrFail($id); $rwth->amount = $request->amount; $rwth->date = $request->date; $rwth->save(); Toastr::success('Withdraw Updated ! :)', 'Success'); return redirect()->route('admin.withdraw.index'); } /** * Remove the specified resource from storage. * * @param \App\ReferenceWithdraw $referenceWithdraw * @return \Illuminate\Http\Response */ public function destroy(ReferenceWithdraw $referenceWithdraw) { if ($referenceWithdraw->delete()) { Toastr::success('Withdraw deleted successfully :)', 'Success'); return redirect()->back(); } else { Toastr::error('Something went wrong :(', 'Error'); return redirect()->back(); } } }