public function beginningBalance() { $exist = $this->journalHistory()->count(); if ($exist) { return $this->fulljournalHistory(); } $accounts = Account::where('company_id', $this->company->id)->get(); foreach ($accounts as $account) { JournalHistory::create(['company_id' => $this->company->id, 'account_id' => $account->id, 'month' => $this->company->month_period, 'year' => $this->company->year_period]); } return $this->fulljournalHistory(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $account = Models\Account::find($id); $account->delete(); return redirect('/accounts'); }