public function __construct(Model $JournalVoucher, $databaseConnectionName) { $this->JournalVoucher = $JournalVoucher; $this->databaseConnectionName = $databaseConnectionName; $this->JournalVoucher->setConnection($databaseConnectionName); }
/** * Create a new set of journal vouchers * * @param array $data * An array as follows: array('number'=>$number, 'date'=>$date, 'manual_reference'=>$manualReference, 'remark'=>$remark, * 'system_reference_type'=>$systemTeferenceType, 'system_reference_field'=>$systemReferenceField, 'system_reference_id'=>$systemReferenceId * 'is_editable'=>$isEditable, 'status'=>$status, 'voucher_type_id'=>$voucherTypeId, 'created_by'=>$created_by, 'organization_id'=>organizationId * ); * * @return Mgallegos\DecimaAccounting\JournalVoucher */ public function create(array $data) { $JournalVoucher = new JournalVoucher(); $JournalVoucher->setConnection($this->databaseConnectionName); $JournalVoucher->fill($data)->save(); return $JournalVoucher; }