本文整理汇总了PHP中Carbon\Carbon::addMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::addMonth方法的具体用法?PHP Carbon::addMonth怎么用?PHP Carbon::addMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Carbon\Carbon
的用法示例。
在下文中一共展示了Carbon::addMonth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onProcessing
/**
* A subscription charge has been marked as processing
*
* @param integer $chargeId
* @param integer $userId
* @param Carbon $paymentDate
* @param double $amount
*/
public function onProcessing($chargeId, $userId, Carbon $paymentDate, $amount)
{
$user = $this->userRepository->getById($userId);
/** @var $user \BB\Entities\User */
$user->extendMembership(null, $paymentDate->addMonth());
}
示例2: addInterval
public function addInterval(Carbon $date)
{
switch ($this->interval) {
case 'yearly':
$date->addYear();
break;
case 'quarterly':
$date->addMonths(3);
break;
case 'weekly':
$date->addWeek();
break;
case 'monthly':
default:
$date->addMonth();
}
return $date;
}
示例3: singleYearInOutSummarized
/**
* @param array $earned
* @param array $spent
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
protected function singleYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end)
{
$income = '0';
$expense = '0';
$count = 0;
while ($start < $end) {
$date = $start->format('Y-m');
$currentIncome = isset($earned[$date]) ? $earned[$date] : 0;
$currentExpense = isset($spent[$date]) ? $spent[$date] : 0;
$income = bcadd($income, $currentIncome);
$expense = bcadd($expense, $currentExpense);
$count++;
$start->addMonth();
}
$data = $this->generator->yearInOutSummarized($income, $expense, $count);
return $data;
}
示例4: createYearHeaders
/**
* @param Carbon $current
* @param Carbon $end
*
* @return array
*/
private function createYearHeaders(Carbon $current, Carbon $end) : array
{
$headers = [];
while ($current < $end) {
$short = $current->format('m-Y');
$headers[$short] = $current->formatLocalized((string) trans('config.month'));
$current->addMonth();
}
return $headers;
}
示例5: show
public function show($id)
{
$success = true;
$message = "La actualizacion se realizo correctamente";
$clients = $this->clienteHostRepo->findByField2('id_host', $id);
$transacciones = $this->transaccionRepo->getAll();
$transaccionHost = [];
$cajeroTransaccion = [];
foreach ($transacciones as $key => $value) {
$transaccionHost[$key] = $value->id;
}
foreach ($clients as $key => $value) {
$cajeroTransaccion[$key] = $value->id_transaccion;
}
$prueba = 0;
for ($i = 0; $i < count($transaccionHost); $i++) {
$contador = 0;
if (count($cajeroTransaccion) != 0) {
for ($x = 0; $x < count($cajeroTransaccion); $x++) {
if ($transaccionHost[$i] == $cajeroTransaccion[$x]) {
$contador++;
}
}
}
if ($contador == 0) {
$transaccionData = $this->transaccionRepo->findOrFail($transaccionHost[$i]);
$creditoData = $this->creditoRepo->findOrFail($transaccionData->idCredito);
if ($transaccionData->tipoTransaccion == 'credito') {
$datos['id_host'] = $id;
$datos['id_cliente'] = $creditoData->idCliente;
$datos['saldo'] = $transaccionData->monto;
$datos['interes'] = $creditoData->interes;
$datos['id_credito'] = $transaccionData->idCredito;
$datos['id_transaccion'] = $transaccionData->id;
$datos['tipo_transaccion'] = $transaccionData->tipoTransaccion;
$registro = $this->clienteHostRepo->create($datos);
$cuota = $this->cuotaRepo->findByField('idCredito', $creditoData->id);
$fecha = new Carbon($cuota->fechaPago);
for ($i = 1; $i <= $creditoData->no_cuotas; $i++) {
$dataCuota['id_clienteHost'] = $registro->id;
$dataCuota['montoCuota'] = $cuota->montoCuota;
$dataCuota['fechaPago'] = $fecha->addMonth();
$dataCuota['estado'] = 'activa';
$dataCuota['balance'] = $cuota->montoCuota;
$this->cuotasHostRepo->create($dataCuota);
}
} else {
$bitacoraBranch = $this->bitacoraRepo->findByField('idTransaccionMaster', $transaccionData->id);
$prueba = $bitacoraBranch['id_cuota_branch'];
$idCreditoBranch = $bitacoraBranch['id_credito_branch'];
$idCuotaBranch = $bitacoraBranch['id_cuota_branch'];
$creditoBranch = $this->clienteHostRepo->findOrFail($idCreditoBranch);
$creditoBranch['saldo'] = $creditoBranch['saldo'] - $transaccionData['monto'];
$creditoBranch->save();
$cuotaBranch = $this->cuotasHostRepo->findOrFail($idCuotaBranch);
$cuotaBranch = $this->cuotasHostRepo->findOrFail($idCuotaBranch);
$cuotaBranch['estado'] = 'Cancelada';
$cuotaBranch['balance'] = 0.0;
$cuotaBranch->save();
}
}
}
return compact('success', 'message');
}
示例6: singleYearInOut
/**
* @param array $earned
* @param array $spent
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
protected function singleYearInOut(array $earned, array $spent, Carbon $start, Carbon $end)
{
// per month? simply use each month.
$entries = new Collection();
while ($start < $end) {
// total income and total expenses:
$date = $start->format('Y-m');
$incomeSum = isset($earned[$date]) ? $earned[$date] : 0;
$expenseSum = isset($spent[$date]) ? $spent[$date] * -1 : 0;
$entries->push([clone $start, $incomeSum, $expenseSum]);
$start->addMonth();
}
$data = $this->generator->yearInOut($entries);
return $data;
}