本文整理汇总了PHP中app\models\Invoice::whereAccountId方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::whereAccountId方法的具体用法?PHP Invoice::whereAccountId怎么用?PHP Invoice::whereAccountId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Invoice
的用法示例。
在下文中一共展示了Invoice::whereAccountId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
public function fire()
{
$this->info(date('Y-m-d') . ' ChargeRenewalInvoices...');
$ninjaAccount = $this->accountRepo->getNinjaAccount();
$invoices = Invoice::whereAccountId($ninjaAccount->id)->whereDueDate(date('Y-m-d'))->where('balance', '>', 0)->with('client')->orderBy('id')->get();
$this->info(count($invoices) . ' invoices found');
foreach ($invoices as $invoice) {
// check if account has switched to free since the invoice was created
$account = Account::find($invoice->client->public_id);
if (!$account) {
continue;
}
$company = $account->company;
if (!$company->plan || $company->plan == PLAN_FREE) {
continue;
}
try {
$this->info("Charging invoice {$invoice->invoice_number}");
$this->paymentService->autoBillInvoice($invoice);
} catch (Exception $exception) {
$this->info('Error: ' . $exception->getMessage());
}
}
$this->info('Done');
}
示例2: fire
public function fire()
{
$this->info(date('Y-m-d') . ' ChargeRenewalInvoices...');
$account = $this->accountRepo->getNinjaAccount();
$invoices = Invoice::whereAccountId($account->id)->whereDueDate(date('Y-m-d'))->with('client')->orderBy('id')->get();
$this->info(count($invoices) . ' invoices found');
foreach ($invoices as $invoice) {
$this->info("Charging invoice {$invoice->invoice_number}");
$this->paymentService->autoBillInvoice($invoice);
}
$this->info('Done');
}
示例3: findNeedingReminding
public function findNeedingReminding($account)
{
$dates = [];
for ($i = 1; $i <= 3; $i++) {
$field = "enable_reminder{$i}";
if (!$account->{$field}) {
continue;
}
$field = "num_days_reminder{$i}";
$dates[] = "due_date = '" . date('Y-m-d', strtotime("- {$account->{$field}} days")) . "'";
}
$sql = implode(' OR ', $dates);
$invoices = Invoice::whereAccountId($account->id)->where('balance', '>', 0)->whereRaw('(' . $sql . ')')->get();
return $invoices;
}
示例4: findNeedingReminding
public function findNeedingReminding($account)
{
$dates = [];
for ($i = 1; $i <= 3; $i++) {
if ($date = $account->getReminderDate($i)) {
$field = $account->{"field_reminder{$i}"} == REMINDER_FIELD_DUE_DATE ? 'due_date' : 'invoice_date';
$dates[] = "{$field} = '{$date}'";
}
}
$sql = implode(' OR ', $dates);
$invoices = Invoice::whereAccountId($account->id)->where('balance', '>', 0)->whereRaw('(' . $sql . ')')->get();
return $invoices;
}