/** * Remove the specified resource from storage. * * @param [int] $id * @return [Response] */ public function destroy($id) { // Check if is_staff if (!$this->is_staff()) { Session::flash('alert_danger', 'Access denied.'); return Redirect::to('dashboard'); } else { try { // Inactivate the Loan $loan = Loan::find($id); $loan->active = 0; $loan->save(); // Save Transaction $transaction = new Transaction(); $transaction->loan_id = $id; $transaction->user_id = $this->user->id; $transaction->transaction_type_id = "3"; $transaction->updated_item_id = $id; $transaction->transaction_description = "Loan Deleted"; $transaction->save(); } catch (\RuntimeException $e) { Session::flash('alert_danger', 'Failed to delete loan.'); return Redirect::to('loan/' . $id); } Session::flash('alert_success', 'Deleted loan successfully.'); return Redirect::to('dashboard'); } }
public function getInfo($id) { return Loan::find($id); }