/** * Retrieve accounts by parent * * @param int $id Organization id * * @return Illuminate\Database\Eloquent\Collection */ public function byParent($id) { return $this->Account->where('parent_account_id', '=', $id)->get(); }
/** * Create a new account * * @param array $data * An array as follows: array('name'=>$name, 'key'=>$key, 'balance_type'=>$balanceType, * 'account_type_id'=>$accountTypeId, 'parent_account_id' => $parentAccountId, 'organization_id'=>$organizationId * ); * * @return boolean */ public function create(array $data) { $Account = new Account(); $Account->setConnection($this->databaseConnectionName); $Account->fill($data)->save(); return $Account; }