public function destroy($id) { $repayment = Repayment::where('debtor_id', '=', $id); $repayment->delete(); $debtor = Debtor::find($id); $debtor->delete(); Session::flash('message', 'Дебитор удален успешно!'); //return Redirect::to('debtor'); }
public function ClearTable() { DailyChargeCommission::Truncate(); //ChargeCommission::Truncate(); Bill::Truncate(); //Repayment::Truncate(); DeliveryToFinance::Truncate(); //Finance::Truncate(); $repayments = Repayment::OrderBy('date')->get(); foreach ($repayments as $repayment) { $repayment->balance = $repayment->sum; $repayment->save(); } return ['callback' => 'success', 'message' => 'Успешно', 'message_shot' => 'Таблицы очищены']; }