/** * Retrieve cost centers by parent * * @param int $id Organization id * * @return Illuminate\Database\Eloquent\Collection */ public function byParent($id) { return $this->CostCenter->where('parent_cc_id', '=', $id)->get(); }
/** * Create a new cost center * * @param array $data * An array as follows: array('name'=>$name, 'key'=>$key, 'parent_cc_id' => $parentCostCenterId, 'organization_id'=>$organizationId, 'is_group'=> $isGroup); * * @return boolean */ public function create(array $data) { $CostCenter = new CostCenter(); $CostCenter->setConnection($this->databaseConnectionName); $CostCenter->fill($data)->save(); return $CostCenter; }