本文整理汇总了PHP中Account::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::with方法的具体用法?PHP Account::with怎么用?PHP Account::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::with方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($clientPublicId = 0)
{
if (!Utils::isPro()) {
return Redirect::to('/invoices/create');
}
$client = null;
$invoiceNumber = Auth::user()->account->getNextInvoiceNumber();
$account = Account::with('country')->findOrFail(Auth::user()->account_id);
if ($clientPublicId) {
$client = Client::scope($clientPublicId)->firstOrFail();
}
$data = array('account' => $account, 'invoice' => null, 'data' => Input::old('data'), 'invoiceNumber' => $invoiceNumber, 'method' => 'POST', 'url' => 'invoices', 'title' => trans('texts.new_quote'), 'client' => $client);
$data = array_merge($data, self::getViewModel());
return View::make('invoices.edit', $data);
}
示例2: 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(), '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(), 'taxRates' => TaxRate::orderBy('name')->get()];
return View::make('accounts.details', $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);
} else {
if ($section == ACCOUNT_BRANCHES) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.branches', $data);
} else {
if ($section == ACCOUNT_GROUPS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.groups', $data);
} else {
if ($section == ACCOUNT_USERS) {
$data = ['account' => Auth::user()->account];
return View::make('accounts.user_management', $data);
}
}
}
}
}
}
}
}
}
示例3: lists
/**
* 菜单列表.
*
* @return array
*/
public function lists($accountId)
{
return $this->model->with('subButtons')->where('account_id', $accountId)->where('parent_id', 0)->orderBy('id', 'asc')->get();
}
示例4: create
public function create($clientPublicId = 0)
{
$client = null;
// $invoiceNumber = Auth::user()->branch->getNextInvoiceNumber();
// 'invoiceNumber' => $invoiceNumber,
$account = Account::with('country')->findOrFail(Auth::user()->account_id);
if ($clientPublicId) {
$client = Client::scope($clientPublicId)->firstOrFail();
}
$invoiceDesigns = InvoiceDesign::where('account_id', \Auth::user()->account_id)->orderBy('public_id', 'desc')->get();
$data = array('entityType' => ENTITY_INVOICE, 'account' => $account, 'invoice' => null, 'showBreadcrumbs' => false, 'data' => Input::old('data'), 'invoiceDesigns' => $invoiceDesigns, 'method' => 'POST', 'url' => 'invoices', 'title' => trans('texts.new_invoice'), 'client' => $client);
$data = array_merge($data, self::getViewModel());
return View::make('invoices.edit', $data);
}
示例5: savePayments
private function savePayments()
{
$rules = array();
$recommendedId = Input::get('recommendedGateway_id');
if ($gatewayId = $recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId) {
$gateway = Gateway::findOrFail($gatewayId);
$paymentLibrary = $gateway->paymentlibrary;
$fields = $gateway->getFields();
foreach ($fields as $field => $details) {
if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName'])) {
if (strtolower($gateway->name) == 'beanstream') {
if (in_array($field, ['merchant_id', 'passCode'])) {
$rules[$gateway->id . '_' . $field] = 'required';
}
} else {
$rules[$gateway->id . '_' . $field] = 'required';
}
}
}
}
$creditcards = Input::get('creditCardTypes');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('company/payments')->withErrors($validator)->withInput();
} else {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
if ($gatewayId) {
$accountGateway = AccountGateway::createNew();
$accountGateway->gateway_id = $gatewayId;
$isMasked = false;
$config = new stdClass();
foreach ($fields as $field => $details) {
$value = trim(Input::get($gateway->id . '_' . $field));
if ($value && $value === str_repeat('*', strlen($value))) {
$isMasked = true;
}
$config->{$field} = $value;
}
$cardCount = 0;
if ($creditcards) {
foreach ($creditcards as $card => $value) {
$cardCount += intval($value);
}
}
if ($isMasked && count($account->account_gateways)) {
$currentGateway = $account->account_gateways[0];
$currentGateway->accepted_credit_cards = $cardCount;
$currentGateway->save();
} else {
$accountGateway->config = json_encode($config);
$accountGateway->accepted_credit_cards = $cardCount;
$account->account_gateways()->delete();
$account->account_gateways()->save($accountGateway);
}
Session::flash('message', trans('texts.updated_settings'));
} else {
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
}
return Redirect::to('company/payments');
}
}
示例6: create
public function create($clientPublicId = 0)
{
$client = null;
$invoiceNumber = Auth::user()->branch->getNextInvoiceNumber();
$account = Account::with('country')->findOrFail(Auth::user()->account_id);
if ($clientPublicId) {
$client = Client::scope($clientPublicId)->firstOrFail();
}
$data = array('account' => $account, 'invoice' => null, 'data' => Input::old('data'), 'invoiceNumber' => $invoiceNumber, 'method' => 'POST', 'url' => 'invoices', 'title' => '- New Invoice', 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->where('id', $clientPublicId)->get(), 'client' => $client);
$data = array_merge($data, self::getViewModel());
return View::make('invoices.edit', $data);
}
示例7: refreshAccount
/**
* Used to refresh an account
* @return Account
*/
protected function refreshAccount($account)
{
return Account::with('user')->with('type')->find($account->id);
}
示例8: 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);
}
}
}
}
}
}
}
示例9: function
<?php
$account = Request::segment(3);
$token = Request::segment(4);
Route::group(['prefix' => 'api/v1/{account}/{token}', 'before' => "api:{$account},{$token}"], function () {
Route::bind('account', function ($value, $route) {
return Account::with('images')->whereAccount($value)->first();
});
Route::resource('images', 'ImagesController');
});
/*
Route::group(['prefix' => 'api/v2', 'before' => 'auth'], function(){
Route::resource('palettes', 'PalettesController');
Route::resource('palettes.colors', 'ColorsController');
Route::resource('images', 'ImagesController');
});
//*/
// php artisan generate:scaffold images --fields="url:string, parameters:string, red:tinyInteger:unsigned, green:tinyInteger:unsigned, blue:tinyInteger:unsigned, alpha:tinyInteger:unsigned, account_id:integer:unsinged"