本文整理匯總了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;
}