本文整理匯總了PHP中Gateway::remember方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gateway::remember方法的具體用法?PHP Gateway::remember怎麽用?PHP Gateway::remember使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gateway
的用法示例。
在下文中一共展示了Gateway::remember方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showSection
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if ($section == ACCOUNT_DETAILS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id];
return View::make('accounts.details', $data);
} else {
if ($section == ACCOUNT_PAYMENTS) {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$accountGateway = null;
$config = null;
$configFields = null;
$selectedCards = 0;
if (count($account->account_gateways) > 0) {
$accountGateway = $account->account_gateways[0];
$config = $accountGateway->config;
$selectedCards = $accountGateway->accepted_credit_cards;
$configFields = json_decode($config);
foreach ($configFields as $configField => $value) {
$configFields->{$configField} = str_repeat('*', strlen($value));
}
} else {
$accountGateway = AccountGateway::createNew();
$accountGateway->gateway_id = GATEWAY_MOOLAH;
}
$recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
$recommendedGatewayArray = array();
foreach ($recommendedGateways as $recommendedGateway) {
$arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
}
$creditCardsArray = unserialize(CREDIT_CARDS);
$creditCards = [];
foreach ($creditCardsArray as $card => $name) {
if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
} else {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
}
}
$otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
$recommendedGatewayArray['Other Options'] = $otherItem;
$gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
foreach ($gateways as $gateway) {
$paymentLibrary = $gateway->paymentlibrary;
$gateway->fields = $gateway->getFields();
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
$accountGateway->fields = $gateway->fields;
}
}
$data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => $gateways, 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
return View::make('accounts.payments', $data);
} else {
if ($section == ACCOUNT_NOTIFICATIONS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
return View::make('accounts.notifications', $data);
} else {
if ($section == ACCOUNT_IMPORT_EXPORT) {
return View::make('accounts.import_export');
} else {
if ($section == ACCOUNT_ADVANCED_SETTINGS) {
$data = ['account' => Auth::user()->account, 'feature' => $subSection];
if ($subSection == ACCOUNT_INVOICE_DESIGN) {
$invoice = new stdClass();
$client = new stdClass();
$invoiceItem = new stdClass();
$client->name = 'Sample Client';
$client->address1 = '';
$client->city = '';
$client->state = '';
$client->postal_code = '';
$client->work_phone = '';
$client->work_email = '';
$invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber();
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->account = json_decode(Auth::user()->account->toJson());
$invoice->amount = $invoice->balance = 100;
$invoiceItem->cost = 100;
$invoiceItem->qty = 1;
$invoiceItem->notes = 'Notes';
$invoiceItem->product_key = 'Item';
$invoice->client = $client;
$invoice->invoice_items = [$invoiceItem];
$data['invoice'] = $invoice;
$data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_' . Auth::user()->maxInvoiceDesignId())->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
}
return View::make("accounts.{$subSection}", $data);
} else {
if ($section == ACCOUNT_PRODUCTS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.products', $data);
}
}
}
}
}
}
}
示例2: showSection
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if (Auth::user()->is_admin) {
if ($section == ACCOUNT_DETAILS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id, 'b' => ''];
return View::make('accounts.details', $data);
} else {
if ($section == ACCOUNT_BRANCHES) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.branches', $data);
} else {
if ($section == ACCOUNT_CATEGORIES) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.categories', $data);
} else {
if ($section == ACCOUNT_MANUALS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.manuals', $data);
} else {
if ($section == ACCOUNT_USERS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.user_management', $data);
} else {
if ($section == ACCOUNT_PAYMENTS) {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$accountGateway = null;
$config = null;
$configFields = null;
$selectedCards = 0;
if (count($account->account_gateways) > 0) {
$accountGateway = $account->account_gateways[0];
$config = $accountGateway->config;
$selectedCards = $accountGateway->accepted_credit_cards;
$configFields = json_decode($config);
foreach ($configFields as $configField => $value) {
$configFields->{$configField} = str_repeat('*', strlen($value));
}
} else {
$accountGateway = AccountGateway::createNew();
$accountGateway->gateway_id = GATEWAY_MOOLAH;
}
$recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
$recommendedGatewayArray = array();
foreach ($recommendedGateways as $recommendedGateway) {
$arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
}
$creditCardsArray = unserialize(CREDIT_CARDS);
$creditCards = [];
foreach ($creditCardsArray as $card => $name) {
if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
} else {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
}
}
$otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
$recommendedGatewayArray['Other Options'] = $otherItem;
$gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
foreach ($gateways as $gateway) {
$paymentLibrary = $gateway->paymentlibrary;
$gateway->fields = $gateway->getFields();
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
$accountGateway->fields = $gateway->fields;
}
}
$data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => $gateways, 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
return View::make('accounts.payments', $data);
} else {
if ($section == ACCOUNT_NOTIFICATIONS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
return View::make('accounts.notifications', $data);
} else {
if ($section == ACCOUNT_IMPORT_EXPORT) {
return View::make('accounts.import_export');
} else {
if ($section == ACCOUNT_EXPORT_BOOK) {
return View::make('accounts.export_book');
} else {
if ($section == ACCOUNT_IMPORT_EXPORTC) {
return View::make('accounts.import_exportc');
} else {
if ($section == ACCOUNT_INVOICE_SETTINGS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.invoice_settings', $data);
} else {
if ($section == ACCOUNT_PRODUCT_SETTINGS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.product_settings', $data);
} else {
if ($section == ACCOUNT_INVOICE_DESIGN) {
$invoiceDesign = DB::table('invoice_designs')->where('account_id', \Auth::user()->account_id)->orderBy('public_id', 'desc')->first();
$branches = Branch::where('account_id', '=', Auth::user()->account_id)->orderBy('id')->get();
$data = ['branches' => $branches, 'invoiceDesign' => $invoiceDesign];
$invoice = new stdClass();
$client = new stdClass();
$invoiceItem = new stdClass();
$client->name = 'Client';
$client->address1 = '';
$client->city = '';
//.........這裏部分代碼省略.........
示例3: showSection
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if ($section == ACCOUNT_DETAILS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(), 'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(), 'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(), 'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get()];
return View::make('accounts.details', $data);
} else {
if ($section == ACCOUNT_PAYMENTS) {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$accountGateway = null;
$config = null;
$configFields = null;
$selectedCards = 0;
if (count($account->account_gateways) > 0) {
$accountGateway = $account->account_gateways[0];
$config = $accountGateway->config;
$selectedCards = $accountGateway->accepted_credit_cards;
$configFields = json_decode($config);
foreach ($configFields as $configField => $value) {
$configFields->{$configField} = str_repeat('*', strlen($value));
}
}
$recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '1')->orderBy('sort_order')->get();
$recommendedGatewayArray = array();
foreach ($recommendedGateways as $recommendedGateway) {
$arrayItem = array('value' => $recommendedGateway->id, 'other' => 'false', 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), 'data-siteUrl' => $recommendedGateway->site_url);
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
}
$creditCardsArray = unserialize(CREDIT_CARDS);
$creditCards = [];
foreach ($creditCardsArray as $card => $name) {
if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
} else {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
}
}
$otherItem = array('value' => 1000000, 'other' => 'true', 'data-imageUrl' => '', 'data-siteUrl' => '');
$recommendedGatewayArray['Other Options'] = $otherItem;
$data = ['account' => $account, 'accountGateway' => $accountGateway, 'config' => $configFields, 'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->where('recommended', '=', '0')->orderBy('name')->get(), 'recommendedGateways' => $recommendedGatewayArray, 'creditCardTypes' => $creditCards];
foreach ($data['gateways'] as $gateway) {
$paymentLibrary = $gateway->paymentlibrary;
$gateway->fields = $gateway->getFields();
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
$accountGateway->fields = $gateway->fields;
}
}
return View::make('accounts.payments', $data);
} else {
if ($section == ACCOUNT_NOTIFICATIONS) {
$data = ['account' => Account::with('users')->findOrFail(Auth::user()->account_id)];
return View::make('accounts.notifications', $data);
} else {
if ($section == ACCOUNT_IMPORT_EXPORT) {
return View::make('accounts.import_export');
} else {
if ($section == ACCOUNT_ADVANCED_SETTINGS) {
$data = ['account' => Auth::user()->account, 'feature' => $subSection];
return View::make("accounts.{$subSection}", $data);
} else {
if ($section == ACCOUNT_PRODUCTS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.products', $data);
}
}
}
}
}
}
}