public function markResolved($id) { $transaction = Transaction::findOrFail($id); $transaction->markResolved(); $this->emailUser($transaction, "Resolved", "good"); $this->grantMembershipIfApplicable($transaction); return Redirect::back()->with("good", "Successfully marked payment as resolved."); }
public function perpanjang($id) { $transaction = Transaction::findOrFail($id); $dateNow = time(); $transaction->update(['borrowed_at' => $dateNow, 'fines' => 0]); session()->flash('flash_message', 'You have been added 1 perpanjang!'); return redirect()->route('peminjaman.laporan'); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // $transactions = Transaction::findOrFail($id); return view('transactions.show')->withTransactions($transactions); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $transaction = Transaction::findOrFail($id); $transaction->delete(); return redirect()->route('transactions.index')->with('message', 'Item deleted successfully.'); }
public static function getTransactionIdFromUserMembershipId($user_membership_id) { return Transaction::findOrFail(DB::table('user_memberships')->join('transactions', 'user_memberships.transaction_id', '=', 'transactions.id')->where('user_memberships.id', '=', $user_membership_id)->select('transactions.id')->first()->id); }
public function getBill($id) { try { $transaction = Transaction::findOrFail($id); return view('transaction.bill', compact('transaction')); } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { return redirect('transaction')->with('message', 'Data dengan kode transaksi tersebut tidak ditemukan!'); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $transaction = Transaction::findOrFail($id); $authuser = Auth::user(); //Update transaction if (Input::has('update')) { $this->validate($request, ['remarks' => 'required']); $input = $request->all(); $transaction->fill($input)->save(); $transaction->status = "In process"; $transaction->save(); //Log $recentLog = Log::where('transaction_id', '=', $transaction->transaction_id)->orderBy('created_at', 'desc')->first(); $firstname = $authuser->firstname; $lastname = $authuser->lastname; $date = new DateTime(); Log::create(['transaction_id' => $transaction->transaction_id, 'processor_name' => $authuser->firstname . ' ' . $authuser->lastname, 'status' => 'In process', 'remarks' => $request['remarks'], 'date_received' => $date, 'date_released' => '', 'next_processor' => '-']); if ($authuser->user_type == "Processor") { return redirect('processor/process_transactions')->withMessage('success update'); } else { return redirect('superadmin/process_transactions')->withMessage('success update'); } } //Log out transaction if (Input::has('out')) { //Log //if processor of recent log is the auth user, update log $recentLog = Log::where('transaction_id', '=', $transaction->transaction_id)->orderBy('created_at', 'desc')->first(); $firstname = $authuser->firstname; $lastname = $authuser->lastname; $complete = Input::has('completed') ? true : false; //completed transaction should only be forwarded to customer or to '-' if ($complete) { $transaction->status = "Completed"; $transaction->save(); if ($request['next_processor'] != "Customer") { $nextprocessor = "-"; } else { $nextprocessor = $request['next_processor']; } //create log $date = new DateTime(); $recent_received = $recentLog->date_received; Log::create(['transaction_id' => $transaction->transaction_id, 'processor_name' => $authuser->firstname . ' ' . $authuser->lastname, 'remarks' => $request['remarks'], 'date_received' => $recent_received, 'date_released' => $date, 'status' => 'Completed', 'next_processor' => $nextprocessor]); } else { $nextprocessor = $request['next_processor']; $recent_released = $recentLog->date_released; if ($recentLog->status == 'Completed') { $transaction->status = "In process"; $transaction->save(); $date = new DateTime(); Log::create(['transaction_id' => $transaction->transaction_id, 'processor_name' => $authuser->firstname . ' ' . $authuser->lastname, 'status' => 'In process', 'remarks' => $request['remarks'], 'date_received' => $recent_released, 'date_released' => $date, 'next_processor' => $nextprocessor]); } else { //add date_released $date = new DateTime(); $recentLog->date_released = $date; $recentLog->remarks = $request['remarks']; $recentLog->next_processor = $nextprocessor; $recentLog->save(); } } if ($authuser->user_type == "Processor") { return redirect('processor/process_transactions')->withMessage('success out'); } else { return redirect('superadmin/process_transactions')->withMessage('success out'); } } }
private function doRemoveFromClass($class, $user) { $classe_user_row = DB::table('classe_user')->where('classe_id', '=', $class->id)->where('user_id', '=', $user->id)->select('transaction_id', 'used_free_space', 'user_membership_id')->first(); DB::table('classe_user')->where('classe_id', '=', $class->id)->where('user_id', '=', $user->id)->delete(); if ($classe_user_row->used_free_space == True) { $user_membership = User_Membership::findOrFail($classe_user_row->user_membership_id); $user_membership->spaces_left = $user_membership->spaces_left + 1; $user_membership->save(); } else { $transaction = Transaction::findOrFail($classe_user_row->transaction_id); $transaction->delete(); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $trans = Transaction::findOrFail($id); $trans->delete(); return response()->success(compact('trans')); }