public function __construct(Model $CostCenter, $databaseConnectionName) { $this->CostCenter = $CostCenter; $this->databaseConnectionName = $databaseConnectionName; $this->CostCenter->setConnection($databaseConnectionName); }
/** * 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; }