コード例 #1
0
 public function __construct()
 {
     parent::__construct();
     $this->data['pageTitle'] = 'Dashboard';
     $this->data['personalID'] = Auth::personales()->get()->personalID;
     $this->data['personal'] = Personal::find(Auth::personales()->get()->id);
     $this->data['beneficiarioID'] = Personal::find(Auth::personales()->get()->id);
     // Del Aportante
     $this->data['donaciones'] = Donacion::where('aportanteID', '=', $this->data['personalID'])->get();
     $this->data['ayudas'] = Ayuda::where('aportanteID', '=', Auth::personales()->get()->personalID)->get();
     $this->data['beneficiario'] = Ayuda::where('aportanteID', '=', Auth::personales()->get()->personalID)->get();
     $ben = json_decode($this->data['beneficiario']);
     $this->data['beneficiarios'] = Beneficiario::where('beneficiarioID', '=', $ben[0]->beneficiarioID)->get();
     $this->data['ingresoTotal'] = 0;
     $this->data['egresoTotal'] = 0;
     foreach ($this->data['ayudas'] as $ayuda) {
         $this->data['egresoTotal'] = $this->data['egresoTotal'] + $ayuda->gastos;
     }
     foreach ($this->data['donaciones'] as $donacion) {
         $this->data['ingresoTotal'] = $this->data['ingresoTotal'] + $donacion->montodonacion;
     }
     $this->data['saldo'] = $this->data['ingresoTotal'] - $this->data['egresoTotal'];
 }
コード例 #2
0
ファイル: AyudasController.php プロジェクト: rodrigopbel/ong
 public function destroy($id)
 {
     if (Request::ajax()) {
         Ayuda::destroy($id);
         $output['success'] = 'deleted';
         Activity::log(['contentId' => $id, 'contentType' => 'Ayuda', 'user_id' => Auth::admin()->get()->id, 'action' => 'Eliminacion', 'description' => 'Eliminacion de ayudas ' . $id, 'details' => 'Usuario: ' . Auth::admin()->get()->name, 'updated' => $id ? true : false]);
         return Response::json($output, 200);
     } else {
         throw new Exception('Wrong request');
     }
 }