/**
  * Update the specified organization in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $organization = Organization::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Organization::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $organization->update($data);
     return Redirect::route('organizations.index');
 }
 public function statement($id)
 {
     $account = Savingaccount::findOrFail($id);
     $transactions = $account->transactions;
     $credit = DB::table('savingtransactions')->where('savingaccount_id', '=', $account->id)->where('type', '=', 'credit')->sum('amount');
     $debit = DB::table('savingtransactions')->where('savingaccount_id', '=', $account->id)->where('type', '=', 'debit')->sum('amount');
     $balance = $credit - $debit;
     $organization = Organization::findOrFail(1);
     $pdf = PDF::loadView('pdf.statement', compact('transactions', 'organization', 'account', 'balance'))->setPaper('a4')->setOrientation('potrait');
     return $pdf->stream('statement.pdf');
 }
 public function receipt($id)
 {
     $transaction = Loantransaction::findOrFail($id);
     $organization = Organization::findOrFail(1);
     $pdf = PDF::loadView('pdf.loanreports.receipt', compact('transaction', 'organization'))->setPaper('a5')->setOrientation('potrait');
     return $pdf->stream('receipt.pdf');
 }
Exemplo n.º 4
0
 public function logo($id)
 {
     if (Input::hasFile('logo')) {
         $destination = public_path() . '/uploads/logo/';
         $filename = str_random(12);
         $ext = Input::file('logo')->getClientOriginalExtension();
         $photo = $filename . '.' . $ext;
         Input::file('logo')->move($destination, $photo);
         $organization = Organization::findOrFail($id);
         $organization->logo = $photo;
         $organization->update();
     }
     //return Redirect::to('organizations');
 }