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(); }