public function destroy() { $atomDao = new BaseDao("CertifierTransactionAtom"); $atom = $atomDao->getPattern(); $atom->transFid = $this->getId(); $list = $atomDao->search($atom); //var_dump($list); foreach ($list as $element) { $element->delete(); } parent::destroy(); }
/** * Remove the specified transaction from storage. * * @param int $id * @return Response */ public function destroy($id) { $data = Input::all(); $transaction = Transaction::find($id); $transactions = $transaction->getRecurringTransactions->filter(function ($t) { if ($t->user_id == Auth::id()) { return $t; } }); if ($transaction->user_id == Auth::id()) { /** * DESTROY ONLY... */ switch (@$data['apply_changes_to']) { case 'this': Transaction::destroy($transaction->id); break; case 'next': $transactions = $transactions->filter(function ($t) use($transaction) { if ($t->date >= $transaction->date) { return $t; } }); // DESTROY THE ITEMS foreach ($transactions as $transaction) { Transaction::destroy($transaction->id); } break; case 'unpaid': $transactions = $transactions->filter(function ($t) { if ($t->done != 1) { return $t; } }); // DESTROY THE ITEMS foreach ($transactions as $t) { Transaction::destroy($t->id); } break; case 'all': // DESTROY THE ITEMS // echo "<pre>"; // print_r($transactions->count()); // exit; foreach ($transactions as $t) { $t->destroy($t->id); } break; default: // SAME OF 'THIS' Transaction::destroy($transaction->id); break; } $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Lançamento excluído!']; } else { $alert[] = ['class' => 'alert-danger', 'message' => '<strong><i class="fa fa-check"></i></strong> Sem permissão para excluir o lançamento!']; } Session::flash('alerts', $alert); return Redirect::to(URL::previous()); }
/** * Remove the specified resource from storage. * DELETE /transactions/{id} * * @param int $id * @return Response */ public function destroy($id) { // Transaction::destroy($id); }
/** * Remove the specified resource from storage. * DELETE /transactions/{id} * * @param int $id * @return Response */ public function destroy($id) { $status = Transaction::destroy($id); return $status ? ['status' => true] : ['status' => false]; }