本文整理汇总了PHP中base_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP base_lang函数的具体用法?PHP base_lang怎么用?PHP base_lang使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了base_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createCustomRecord
public function createCustomRecord($parameters)
{
$parameters['services'] = Service::where('lang_id_153', $parameters['lang']->id_001)->get();
$parameters['environments'] = Environment::where('lang_id_150', $parameters['lang']->id_001)->get();
$parameters['decorations'] = Decoration::where('lang_id_151', $parameters['lang']->id_001)->get();
$parameters['relationships'] = Relationship::where('lang_id_152', $parameters['lang']->id_001)->get();
$parameters['publications'] = Publication::all();
$parameters['restaurantTypes'] = array_map(function ($object) {
$object->name = trans($object->name);
return $object;
}, config('hotels.restaurantTypes'));
$parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'hotels-hotel']);
$parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'hotels-hotel')->get();
$parameters['attachmentsInput'] = json_encode([]);
$parameters['hotelProductsIds'] = json_encode([]);
$parameters['products'] = Product::builder()->where('active_111', true)->where('lang_id_112', $parameters['lang']->id_001)->get();
// get attachments products with photo list
$parameters['attachmentsProducts'] = Attachment::builder()->where('lang_id_016', $parameters['lang']->id_001)->where('resource_id_016', 'market-product')->where('family_id_016', config('hotels.idAttachmentsFamily.productList'))->get()->keyBy('object_id_016');
if (isset($parameters['id'])) {
// get attachments from base lang
$attachments = AttachmentLibrary::getRecords($this->package, 'hotels-hotel', $parameters['id'], base_lang()->id_001, true);
// merge parameters and attachments array
$parameters = array_merge($parameters, $attachments);
// get hotel products
$parameters['hotelProducts'] = HotelProduct::getRecords(['hotel_id_177' => $parameters['id'], 'lang_id_177' => base_lang()->id_001])->keyBy('product_id_177');
$parameters['hotelProductsIds'] = json_encode($parameters['hotelProducts']->keys()->map(function ($item, $key) {
return strval($item);
}));
}
return $parameters;
}
示例2: customIndex
public function customIndex($parameters)
{
$parameters['urlParameters']['lang'] = base_lang()->id_001;
$parameters['field'] = CustomField::getTranslationRecord(['id' => $parameters['field'], 'lang' => $parameters['lang']]);
$parameters['customTransHeader'] = trans_choice($this->objectTrans, 2) . ' (' . trans_choice('pulsar::pulsar.field', 1) . ': ' . $parameters['field']->name_026 . ')';
return $parameters;
}
示例3: jsonTerritorialAreas1FromCountry
public function jsonTerritorialAreas1FromCountry($country)
{
if ($country == "null") {
return response()->json(['status' => 'error', 'message' => 'We expect a correct country code'], 400);
} else {
return response()->json(['status' => 'success', 'data' => Country::where('id_002', $country)->where('lang_id_002', base_lang()->id_001)->first()->getTerritorialAreas1]);
}
}
示例4: editCustomRecord
public function editCustomRecord($parameters)
{
$parameters['territorialAreas1'] = TerritorialArea1::getTerritorialAreas1FromCountry($parameters['country']);
$parameters['country'] = Country::where('id_002', $parameters['country'])->where('lang_id_002', base_lang()->id_001)->first();
$parameters['customTrans'] = $parameters['country']->territorial_area_2_002;
$parameters['customTransHeader'] = $parameters['country']->territorial_area_2_002 . ' (' . $parameters['country']->name_002 . ')';
return $parameters;
}
示例5: customCount
public static function customCount($request, $parameters)
{
$query = TerritorialArea2::builder();
if (isset($parameters['country'])) {
$query->where('country_id_004', $parameters['country']);
}
if (isset($parameters['lang'])) {
$query->where('lang_id_002', $parameters['lang']);
} else {
$query->where('lang_id_002', base_lang()->id_001);
}
return $query;
}
示例6: scopeBuilder
public function scopeBuilder($query, $lang = null)
{
return $query->leftJoin('012_111_product', '012_117_order_row.product_id_117', '=', '012_111_product.id_111')->leftJoin('012_112_product_lang', function ($join) use($lang) {
$join->on('012_111_product.id_111', '=', '012_112_product_lang.id_112');
if ($lang !== null) {
$join->where('012_112_product_lang.lang_id_112', '=', $lang);
} else {
// always need filter by lang, because order form,
// need filter your order rows by lang without pass lang variable
$join->where('012_112_product_lang.lang_id_112', '=', base_lang()->id_001);
}
});
}
示例7: createCustomRecord
public function createCustomRecord($parameters)
{
$parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'spas-spa']);
$parameters['customFieldGroups'] = CustomFieldGroup::where('resource_id_025', 'spas-spa')->get();
$parameters['attachmentsInput'] = json_encode([]);
$parameters['hotels'] = Hotel::builder()->where('active_170', true)->get();
if (isset($parameters['id'])) {
// get attachments from base lang
$attachments = AttachmentLibrary::getRecords($this->package, 'spas-spa', $parameters['id'], base_lang()->id_001, true);
// merge parameters and attachments array
$parameters = array_merge($parameters, $attachments);
}
return $parameters;
}
示例8: scopeBuilder
public function scopeBuilder($query)
{
// we not relate to countries, because there are two countries which relate, invoice and shipping, has not been found to create aliases on columns within a join
return $query->join('009_301_customer', '012_116_order.customer_id_116', '=', '009_301_customer.id_301')->join('012_115_payment_method', function ($join) {
$join->on('012_116_order.payment_method_id_116', '=', '012_115_payment_method.id_115')->where('012_115_payment_method.lang_id_115', '=', base_lang()->id_001);
})->join('012_114_order_status', function ($join) {
$join->on('012_116_order.status_id_116', '=', '012_114_order_status.id_114')->where('012_114_order_status.lang_id_114', '=', base_lang()->id_001);
});
/*
->join('001_002_country', function ($join) {
$join->on('012_116_order.invoice_country_id_116', '=', '001_002_country.id_002')
->on('001_002_country.lang_id_002', '=', '001_001_lang.id_001');
})
->join('001_002_country', function ($join) {
$join->on('012_116_order.shipping_country_id_116', '=', '001_002_country.id_002')
->on('001_002_country.lang_id_002', '=', '001_001_lang.id_001');
});
*/
}
示例9: getRecords
/**
* Function to get attachment element with json string to new element
*
* @access public
* @param string $routesConfigFile
* @param string $resource
* @param integer $objectId
* @param string $lang
* @param boolean $copyAttachment
* @return array $response
*/
public static function getRecords($routesConfigFile, $resource, $objectId, $lang, $copyAttachment = false)
{
$response['attachments'] = Attachment::getRecords(['lang_id_016' => $lang, 'resource_id_016' => $resource, 'object_id_016' => $objectId, 'orderBy' => ['column' => 'sorting_016', 'order' => 'asc']]);
$attachmentsInput = [];
foreach ($response['attachments'] as &$attachment) {
$tmpFileName = null;
if ($copyAttachment) {
// function to duplicate files if we create a new lang object
// copy attachments base lang article to temp folder
$tmpFileName = uniqid();
File::copy(public_path() . config($routesConfigFile . '.attachmentFolder') . '/' . $objectId . '/' . base_lang()->id_001 . '/' . $attachment->file_name_016, public_path() . config($routesConfigFile . '.tmpFolder') . '/' . $tmpFileName);
// store tmp file name in attachment to know temporal name
$attachment['tmp_file_name_016'] = $tmpFileName;
}
// get json data from attachment
$attachmentData = json_decode($attachment->data_016);
$attachmentsInput[] = ['id' => $attachment->id_016, 'family' => $attachment->family_id_016, 'type' => ['id' => $attachment->type_id_016, 'name' => $attachment->type_text_016, 'icon' => $attachmentData->icon], 'mime' => $attachment->mime_016, 'name' => $attachment->name_016, 'folder' => $copyAttachment ? config($routesConfigFile . '.tmpFolder') : config($routesConfigFile . '.attachmentFolder') . '/' . $attachment->object_id_016 . '/' . $attachment->lang_id_016, 'tmpFileName' => $tmpFileName, 'fileName' => $attachment->file_name_016, 'width' => $attachment->width_016, 'height' => $attachment->height_016, 'library' => $attachment->library_id_016, 'libraryFileName' => $attachment->library_file_name_016, 'sorting' => $attachment->sorting_016];
}
$response['attachmentsInput'] = json_encode($attachmentsInput);
return $response;
}
示例10: createCustomRecord
public function createCustomRecord($parameters)
{
$parameters['sections'] = Section::all();
$parameters['families'] = ArticleFamily::all();
$parameters['tags'] = [];
$tags = Tag::builder()->where('lang_id_358', $parameters['lang']->id_001)->get();
foreach ($tags as $tag) {
$parameters['tags'][] = ['value' => $tag->id_358, 'label' => $tag->name_358];
}
$parameters['categories'] = Category::builder()->where('lang_id_352', $parameters['lang']->id_001)->get();
$parameters['statuses'] = [(object) ['id' => 0, 'name' => trans('cms::pulsar.draft')], (object) ['id' => 1, 'name' => trans('cms::pulsar.publish')]];
$parameters['attachmentFamilies'] = AttachmentFamily::getAttachmentFamilies(['resource_id_015' => 'cms-article']);
$parameters['attachmentsInput'] = json_encode([]);
if (isset($parameters['id'])) {
// get attachments from base lang
$attachments = AttachmentLibrary::getRecords($this->package, 'cms-article', $parameters['id'], base_lang()->id_001, true);
// merge parameters and attachments array
$parameters = array_merge($parameters, $attachments);
}
return $parameters;
}
示例11: scopeBuilder
public function scopeBuilder($query)
{
return $query->join('012_111_product', '011_222_product_prefix.product_id_222', '=', '012_111_product.id_111')->join('012_112_product_lang', '012_111_product.id_111', '=', '012_112_product_lang.id_112')->join('001_001_lang', '012_112_product_lang.lang_id_112', '=', '001_001_lang.id_001')->where('012_112_product_lang.lang_id_112', base_lang()->id_001);
}
示例12: scopeBuilder
public function scopeBuilder($query)
{
return $query->join('001_002_country', function ($join) {
$join->on('012_103_tax_rate_zone.country_id_103', '=', '001_002_country.id_002')->where('001_002_country.lang_id_002', '=', base_lang()->id_001);
});
}
示例13: updateCustomRecord
public function updateCustomRecord($parameters)
{
$order = Order::find($parameters['id']);
Order::where('id_116', $parameters['id'])->update(['status_id_116' => $this->request->input('status'), 'payment_method_id_116' => $this->request->input('paymentMethod'), 'comments_116' => $this->request->has('comments') ? $this->request->input('comments') : null, 'has_gift_116' => $this->request->has('gift'), 'gift_from_116' => $this->request->has('giftFrom') ? $this->request->input('giftFrom') : null, 'gift_to_116' => $this->request->has('giftTo') ? $this->request->input('giftTo') : null, 'gift_message_116' => $this->request->has('giftMessage') ? $this->request->input('giftMessage') : null, 'customer_id_116' => $this->request->input('customerId'), 'customer_company_116' => $this->request->has('customerCompany') ? $this->request->input('customerCompany') : null, 'customer_tin_116' => $this->request->has('customerTin') ? $this->request->input('customerTin') : null, 'customer_name_116' => $this->request->has('customerName') ? $this->request->input('customerName') : null, 'customer_surname_116' => $this->request->has('customerSurname') ? $this->request->input('customerSurname') : null, 'customer_email_116' => $this->request->input('customerEmail'), 'customer_phone_116' => $this->request->has('customerPhone') ? $this->request->input('customerPhone') : null, 'customer_mobile_116' => $this->request->has('customerMobile') ? $this->request->input('customerMobile') : null, 'has_shipping_116' => $this->request->has('hasShipping'), 'shipping_company_116' => $this->request->has('shippingCompany') ? $this->request->input('shippingCompany') : null, 'shipping_name_116' => $this->request->has('shippingName') ? $this->request->input('shippingName') : null, 'shipping_surname_116' => $this->request->has('shippingSurname') ? $this->request->input('shippingSurname') : null, 'shipping_email_116' => $this->request->has('shippingEmail') ? $this->request->input('shippingEmail') : null, 'shipping_phone_116' => $this->request->has('shippingPhone') ? $this->request->input('shippingPhone') : null, 'shipping_mobile_116' => $this->request->has('shippingMobile') ? $this->request->input('shippingMobile') : null, 'shipping_amount_116' => $this->request->has('shippingAmount') ? $this->request->input('shippingAmount') : 0]);
// if order status is different that previous status order, we record this change
if ($order->status_id_116 != (int) $this->request->input('status')) {
$orderStatus = OrderStatus::builder()->where('lang_id_114', base_lang()->id_001)->where('active_114', true)->get();
Order::setOrderLog($parameters['id'], trans('market::pulsar.message_user_change_order_status', ['user' => auth('pulsar')->user()->user_010, 'oldStatus' => $orderStatus->where('id_114', $order->status_id_116)->first()->name_114, 'newStatus' => $orderStatus->where('id_114', (int) $this->request->input('status'))->first()->name_114]));
}
}
示例14: scopeBuilder
public function scopeBuilder($query)
{
return $query->join('008_075_customer', '008_078_request.customer_id_078', '=', '008_075_customer.id_075')->join('001_010_user', '008_078_request.supervisor_id_078', '=', '001_010_user.id_010')->join('008_074_company', '008_078_request.company_id_078', '=', '008_074_company.id_074')->join('008_076_shop', '008_078_request.shop_id_078', '=', '008_076_shop.id_076')->join('008_077_address', '008_078_request.address_id_078', '=', '008_077_address.id_077')->join('008_071_brand', '008_078_request.brand_id_078', '=', '008_071_brand.id_071')->join('008_072_product', '008_078_request.product_id_078', '=', '008_072_product.id_072')->join('008_070_family', '008_078_request.family_id_078', '=', '008_070_family.id_070')->join('001_002_country', function ($join) {
$join->on('008_078_request.country_id_078', '=', '001_002_country.id_002')->where('001_002_country.lang_id_002', '=', base_lang()->id_001);
})->leftJoin('001_003_territorial_area_1', '008_078_request.territorial_area_1_id_078', '=', '001_003_territorial_area_1.id_003')->leftJoin('001_004_territorial_area_2', '008_078_request.territorial_area_2_id_078', '=', '001_004_territorial_area_2.id_004');
}
示例15: getDataObjects
public function getDataObjects(Request $request)
{
$parameters = $request->route()->parameters();
$result = collect(config('booking.models'))->where('id', (int) $parameters['model']);
if (count($result) === 0) {
return response()->json(['status' => 'error', 'code' => 404, 'message' => 'Records not found']);
}
// model constructor
$model = App::make($result->first()->model);
$name = trans_choice($result->first()->name, 1);
$primaryKey = $model->getKeyName();
$suffix = $model->getSuffix();
// use sofa to get lang from lang table of object query
$objects = $model->builder()->where('lang_id', base_lang()->id_001)->get();
return response()->json(['status' => 'success', 'name' => $name, 'primaryKey' => $primaryKey, 'suffix' => $suffix, 'objects' => $objects]);
}