Version Improvement
This commit is contained in:
parent
05518fab7d
commit
fff092adf4
|
|
@ -1,6 +1,5 @@
|
||||||
APP_NAME=Bagisto
|
APP_NAME=Bagisto
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_VERSION=1.3.3
|
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
|
||||||
|
|
@ -157,16 +157,11 @@ return [
|
||||||
|
|
||||||
'cipher' => 'AES-256-CBC',
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Code Editor
|
* Code editor.
|
||||||
*/
|
*/
|
||||||
'editor' => 'vscode',
|
'editor' => 'vscode',
|
||||||
|
|
||||||
/*
|
|
||||||
Application Version
|
|
||||||
*/
|
|
||||||
'version' => env('APP_VERSION'),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blacklisting attributes while debugging
|
* Blacklisting attributes while debugging
|
||||||
*/
|
*/
|
||||||
|
|
@ -200,7 +195,7 @@ return [
|
||||||
'providers' => [
|
'providers' => [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Laravel Framework Service Providers...
|
* Laravel Framework Service Providers.
|
||||||
*/
|
*/
|
||||||
Illuminate\Auth\AuthServiceProvider::class,
|
Illuminate\Auth\AuthServiceProvider::class,
|
||||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||||
|
|
@ -226,13 +221,15 @@ return [
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Astrotomic\Translatable\TranslatableServiceProvider::class,
|
Astrotomic\Translatable\TranslatableServiceProvider::class,
|
||||||
|
Intervention\Image\ImageServiceProvider::class,
|
||||||
|
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers.
|
||||||
*/
|
*/
|
||||||
App\Providers\AppServiceProvider::class,
|
App\Providers\AppServiceProvider::class,
|
||||||
App\Providers\AuthServiceProvider::class,
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
|
@ -240,19 +237,17 @@ return [
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
App\Providers\RouteServiceProvider::class,
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
|
||||||
//Laravel Intervention
|
/**
|
||||||
Intervention\Image\ImageServiceProvider::class,
|
* Repository Service Providers.
|
||||||
|
*/
|
||||||
//Laravel Maatwebsite
|
|
||||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
|
||||||
|
|
||||||
//Repository
|
|
||||||
Prettus\Repository\Providers\RepositoryServiceProvider::class,
|
Prettus\Repository\Providers\RepositoryServiceProvider::class,
|
||||||
Konekt\Concord\ConcordServiceProvider::class,
|
Konekt\Concord\ConcordServiceProvider::class,
|
||||||
Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider::class,
|
Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider::class,
|
||||||
Barryvdh\DomPDF\ServiceProvider::class,
|
Barryvdh\DomPDF\ServiceProvider::class,
|
||||||
|
|
||||||
//Webkul packages
|
/**
|
||||||
|
* Webkul Package Service Providers.
|
||||||
|
*/
|
||||||
Webkul\Theme\Providers\ThemeServiceProvider::class,
|
Webkul\Theme\Providers\ThemeServiceProvider::class,
|
||||||
Webkul\User\Providers\UserServiceProvider::class,
|
Webkul\User\Providers\UserServiceProvider::class,
|
||||||
Webkul\Admin\Providers\AdminServiceProvider::class,
|
Webkul\Admin\Providers\AdminServiceProvider::class,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
@php
|
@php
|
||||||
$orderStatusMessages = [
|
$orderStatusMessages = [
|
||||||
'pending' => trans('admin::app.notification.order-status-messages.pending'),
|
'pending' => trans('admin::app.notification.order-status-messages.pending'),
|
||||||
'canceled'=> trans('admin::app.notification.order-status-messages.canceled'),
|
'canceled'=> trans('admin::app.notification.order-status-messages.canceled'),
|
||||||
'closed' => trans('admin::app.notification.order-status-messages.closed'),
|
'closed' => trans('admin::app.notification.order-status-messages.closed'),
|
||||||
'completed'=> trans('admin::app.notification.order-status-messages.completed'),
|
'completed'=> trans('admin::app.notification.order-status-messages.completed'),
|
||||||
'processing' => trans('admin::app.notification.order-status-messages.processing')
|
'processing' => trans('admin::app.notification.order-status-messages.processing')
|
||||||
];
|
];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="navbar-top">
|
<div class="navbar-top">
|
||||||
<div class="navbar-top-left">
|
<div class="navbar-top-left">
|
||||||
@include ('admin::layouts.mobile-nav')
|
@include ('admin::layouts.mobile-nav')
|
||||||
|
|
||||||
<div class="brand-logo">
|
<div class="brand-logo">
|
||||||
<a href="{{ route('admin.dashboard.index') }}">
|
<a href="{{ route('admin.dashboard.index') }}">
|
||||||
@if (core()->getConfigData('general.design.admin_logo.logo_image', core()->getCurrentChannelCode()))
|
@if (core()->getConfigData('general.design.admin_logo.logo_image', core()->getCurrentChannelCode()))
|
||||||
|
|
@ -36,10 +36,10 @@
|
||||||
<a href="{{ route('shop.home.index') }}" target="_blank" style="display: inline-block; vertical-align: middle;">
|
<a href="{{ route('shop.home.index') }}" target="_blank" style="display: inline-block; vertical-align: middle;">
|
||||||
<span class="icon store-icon" data-toggle="tooltip" data-placement="bottom" title="{{ __('admin::app.layouts.visit-shop') }}"></span>
|
<span class="icon store-icon" data-toggle="tooltip" data-placement="bottom" title="{{ __('admin::app.layouts.visit-shop') }}"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<notification
|
<notification
|
||||||
get-notification-url="{{ route('admin.notification.get-notification') }}"
|
get-notification-url="{{ route('admin.notification.get-notification') }}"
|
||||||
view-all="{{ route('admin.notification.index') }}"
|
view-all="{{ route('admin.notification.index') }}"
|
||||||
order-view-url="{{ \URL::to('/') }}/admin/viewed-notifications/"
|
order-view-url="{{ \URL::to('/') }}/admin/viewed-notifications/"
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
get-read-all-url="{{ route('admin.notification.read-all') }}"
|
get-read-all-url="{{ route('admin.notification.read-all') }}"
|
||||||
order-status-messages="{{ json_encode($orderStatusMessages) }}"
|
order-status-messages="{{ json_encode($orderStatusMessages) }}"
|
||||||
read-all-title="{{ __('admin::app.notification.read-all') }}">
|
read-all-title="{{ __('admin::app.notification.read-all') }}">
|
||||||
</notification>
|
</notification>
|
||||||
|
|
||||||
<div class="profile-info">
|
<div class="profile-info">
|
||||||
<div class="dropdown-toggle">
|
<div class="dropdown-toggle">
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dropdown-list bottom-right">
|
<div class="dropdown-list bottom-right">
|
||||||
<span class="app-version">{{ __('admin::app.layouts.app-version', ['version' => 'v' . config('app.version')]) }}</span>
|
<span class="app-version">{{ __('admin::app.layouts.app-version', ['version' => 'v' . core()->version()]) }}</span>
|
||||||
|
|
||||||
<div class="dropdown-container">
|
<div class="dropdown-container">
|
||||||
<label>{{ __('admin::app.layouts.account-title') }}</label>
|
<label>{{ __('admin::app.layouts.account-title') }}</label>
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
<li v-if="!isMobile()" style="display: flex;justify-content: space-between;">
|
<li v-if="!isMobile()" style="display: flex;justify-content: space-between;">
|
||||||
<div style="margin-top:7px">{{ __('admin::app.layouts.mode') }}</div>
|
<div style="margin-top:7px">{{ __('admin::app.layouts.mode') }}</div>
|
||||||
<dark style="margin-top: -9px;width: 83px;"></dark>
|
<dark style="margin-top: -9px;width: 83px;"></dark>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ class BagistoVersion extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$this->comment('v' . config('app.version'));
|
$this->comment('v' . core()->version());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,62 +17,71 @@ use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||||
class Core
|
class Core
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* ChannelRepository class
|
* The Bagisto version.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const BAGISTO_VERSION = '1.x-dev';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Channel repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\ChannelRepository
|
* @var \Webkul\Core\Repositories\ChannelRepository
|
||||||
*/
|
*/
|
||||||
protected $channelRepository;
|
protected $channelRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CurrencyRepository class
|
* Currency repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\CurrencyRepository
|
* @var \Webkul\Core\Repositories\CurrencyRepository
|
||||||
*/
|
*/
|
||||||
protected $currencyRepository;
|
protected $currencyRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExchangeRateRepository class
|
* Exchange rate repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\ExchangeRateRepository
|
* @var \Webkul\Core\Repositories\ExchangeRateRepository
|
||||||
*/
|
*/
|
||||||
protected $exchangeRateRepository;
|
protected $exchangeRateRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CountryRepository class
|
* Country repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\CountryRepository
|
* @var \Webkul\Core\Repositories\CountryRepository
|
||||||
*/
|
*/
|
||||||
protected $countryRepository;
|
protected $countryRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CountryStateRepository class
|
* Country state repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\CountryStateRepository
|
* @var \Webkul\Core\Repositories\CountryStateRepository
|
||||||
*/
|
*/
|
||||||
protected $countryStateRepository;
|
protected $countryStateRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LocaleRepository class
|
* Locale repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\LocaleRepository
|
* @var \Webkul\Core\Repositories\LocaleRepository
|
||||||
*/
|
*/
|
||||||
protected $localeRepository;
|
protected $localeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CustomerGroupRepository class
|
* Customer group repository instance.
|
||||||
*
|
*
|
||||||
* @var CustomerGroupRepository
|
* @var CustomerGroupRepository
|
||||||
*/
|
*/
|
||||||
protected $customerGroupRepository;
|
protected $customerGroupRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoreConfigRepository class
|
* Core config repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Core\Repositories\CoreConfigRepository
|
* @var \Webkul\Core\Repositories\CoreConfigRepository
|
||||||
*/
|
*/
|
||||||
protected $coreConfigRepository;
|
protected $coreConfigRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Channel.
|
||||||
|
*
|
||||||
* @var \Webkul\Core\Models\Channel
|
* @var \Webkul\Core\Models\Channel
|
||||||
*/
|
*/
|
||||||
private static $channel;
|
private static $channel;
|
||||||
|
|
@ -83,21 +92,20 @@ class Core
|
||||||
* everytime the `getConfigData` method is called.
|
* everytime the `getConfigData` method is called.
|
||||||
*/
|
*/
|
||||||
private $coreConfigExceptions = [
|
private $coreConfigExceptions = [
|
||||||
'catalog.products.guest-checkout.allow-guest-checkout'
|
'catalog.products.guest-checkout.allow-guest-checkout',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*
|
*
|
||||||
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
|
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
|
||||||
* @param \Webkul\Core\Repositories\CurrencyRepository $currencyRepository
|
* @param \Webkul\Core\Repositories\CurrencyRepository $currencyRepository
|
||||||
* @param \Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
|
* @param \Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
|
||||||
* @param \Webkul\Core\Repositories\CountryRepository $countryRepository
|
* @param \Webkul\Core\Repositories\CountryRepository $countryRepository
|
||||||
* @param \Webkul\Core\Repositories\CountryStateRepository $countryStateRepository
|
* @param \Webkul\Core\Repositories\CountryStateRepository $countryStateRepository
|
||||||
* @param \Webkul\Core\Repositories\LocaleRepository $localeRepository
|
* @param \Webkul\Core\Repositories\LocaleRepository $localeRepository
|
||||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||||
* @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfigRepository
|
* @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfigRepository
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
@ -109,8 +117,7 @@ class Core
|
||||||
LocaleRepository $localeRepository,
|
LocaleRepository $localeRepository,
|
||||||
CustomerGroupRepository $customerGroupRepository,
|
CustomerGroupRepository $customerGroupRepository,
|
||||||
CoreConfigRepository $coreConfigRepository
|
CoreConfigRepository $coreConfigRepository
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
$this->channelRepository = $channelRepository;
|
$this->channelRepository = $channelRepository;
|
||||||
|
|
||||||
$this->currencyRepository = $currencyRepository;
|
$this->currencyRepository = $currencyRepository;
|
||||||
|
|
@ -128,6 +135,16 @@ class Core
|
||||||
$this->coreConfigRepository = $coreConfigRepository;
|
$this->coreConfigRepository = $coreConfigRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the version number of the Bagisto.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function version()
|
||||||
|
{
|
||||||
|
return static::BAGISTO_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all channels.
|
* Returns all channels.
|
||||||
*
|
*
|
||||||
|
|
@ -171,7 +188,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Set the current channel.
|
* Set the current channel.
|
||||||
*
|
*
|
||||||
* @param Channel $channel
|
* @param Channel $channel
|
||||||
*/
|
*/
|
||||||
public function setCurrentChannel(Channel $channel): void
|
public function setCurrentChannel(Channel $channel): void
|
||||||
{
|
{
|
||||||
|
|
@ -256,9 +273,7 @@ class Core
|
||||||
*/
|
*/
|
||||||
public function getChannelName($channel): string
|
public function getChannelName($channel): string
|
||||||
{
|
{
|
||||||
return $channel->name
|
return $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name;
|
||||||
?? $channel->translate(app()->getLocale())->name
|
|
||||||
?? $channel->translate(config('app.fallback_locale'))->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -294,7 +309,7 @@ class Core
|
||||||
|
|
||||||
return $data = [
|
return $data = [
|
||||||
'channel' => $channel,
|
'channel' => $channel,
|
||||||
'locales' => $channel->locales
|
'locales' => $channel->locales,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -531,10 +546,9 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Converts price.
|
* Converts price.
|
||||||
*
|
*
|
||||||
* @param float $amount
|
* @param float $amount
|
||||||
* @param string $targetCurrencyCode
|
* @param string $targetCurrencyCode
|
||||||
* @param string $orderCurrencyCode
|
* @param string $orderCurrencyCode
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function convertPrice($amount, $targetCurrencyCode = null, $orderCurrencyCode = null)
|
public function convertPrice($amount, $targetCurrencyCode = null, $orderCurrencyCode = null)
|
||||||
|
|
@ -571,7 +585,7 @@ class Core
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = (float)$amount * (float)($this->lastCurrencyCode == $targetCurrency->code ? 1.0 : $exchangeRate->rate);
|
$result = (float) $amount * (float) ($this->lastCurrencyCode == $targetCurrency->code ? 1.0 : $exchangeRate->rate);
|
||||||
|
|
||||||
if ($this->lastCurrencyCode != $targetCurrency->code) {
|
if ($this->lastCurrencyCode != $targetCurrency->code) {
|
||||||
$this->lastCurrencyCode = $targetCurrency->code;
|
$this->lastCurrencyCode = $targetCurrency->code;
|
||||||
|
|
@ -583,9 +597,8 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Converts to base price.
|
* Converts to base price.
|
||||||
*
|
*
|
||||||
* @param float $amount
|
* @param float $amount
|
||||||
* @param string $targetCurrencyCode
|
* @param string $targetCurrencyCode
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function convertToBasePrice($amount, $targetCurrencyCode = null)
|
public function convertToBasePrice($amount, $targetCurrencyCode = null)
|
||||||
|
|
@ -606,14 +619,13 @@ class Core
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (float)$amount / $exchangeRate->rate;
|
return (float) $amount / $exchangeRate->rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format and convert price with currency symbol.
|
* Format and convert price with currency symbol.
|
||||||
*
|
*
|
||||||
* @param float $price
|
* @param float $price
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function currency($amount = 0)
|
public function currency($amount = 0)
|
||||||
|
|
@ -628,8 +640,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Return currency symbol from currency code.
|
* Return currency symbol from currency code.
|
||||||
*
|
*
|
||||||
* @param float $price
|
* @param float $price
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function currencySymbol($code)
|
public function currencySymbol($code)
|
||||||
|
|
@ -642,14 +653,14 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Format and convert price with currency symbol.
|
* Format and convert price with currency symbol.
|
||||||
*
|
*
|
||||||
* @param float $price
|
* @param float $price
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function formatPrice($price, $currencyCode)
|
public function formatPrice($price, $currencyCode)
|
||||||
{
|
{
|
||||||
if (is_null($price))
|
if (is_null($price)) {
|
||||||
$price = 0;
|
$price = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$formatter = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY);
|
$formatter = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY);
|
||||||
|
|
||||||
|
|
@ -667,9 +678,9 @@ class Core
|
||||||
|
|
||||||
$pattern = $formater->getPattern();
|
$pattern = $formater->getPattern();
|
||||||
|
|
||||||
$pattern = str_replace("¤", "%s", $pattern);
|
$pattern = str_replace('¤', '%s', $pattern);
|
||||||
|
|
||||||
$pattern = str_replace("#,##0.00", "%v", $pattern);
|
$pattern = str_replace('#,##0.00', '%v', $pattern);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'symbol' => $this->currencySymbol($this->getCurrentCurrencyCode()),
|
'symbol' => $this->currencySymbol($this->getCurrentCurrencyCode()),
|
||||||
|
|
@ -682,9 +693,8 @@ class Core
|
||||||
* Format price with base currency symbol. This method also give ability to encode
|
* Format price with base currency symbol. This method also give ability to encode
|
||||||
* the base currency symbol and its optional.
|
* the base currency symbol and its optional.
|
||||||
*
|
*
|
||||||
* @param float $price
|
* @param float $price
|
||||||
* @param bool $isEncoded
|
* @param bool $isEncoded
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function formatBasePrice($price, $isEncoded = false)
|
public function formatBasePrice($price, $isEncoded = false)
|
||||||
|
|
@ -713,10 +723,9 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Checks if current date of the given channel (in the channel timezone) is within the range.
|
* Checks if current date of the given channel (in the channel timezone) is within the range.
|
||||||
*
|
*
|
||||||
* @param int|string|\Webkul\Core\Contracts\Channel $channel
|
* @param int|string|\Webkul\Core\Contracts\Channel $channel
|
||||||
* @param string|null $dateFrom
|
* @param string|null $dateFrom
|
||||||
* @param string|null $dateTo
|
* @param string|null $dateTo
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isChannelDateInInterval($dateFrom = null, $dateTo = null)
|
public function isChannelDateInInterval($dateFrom = null, $dateTo = null)
|
||||||
|
|
@ -747,9 +756,8 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Get channel timestamp, timstamp will be builded with channel timezone settings.
|
* Get channel timestamp, timstamp will be builded with channel timezone settings.
|
||||||
*
|
*
|
||||||
* @param \Webkul\Core\Contracts\Channel $channel
|
* @param \Webkul\Core\Contracts\Channel $channel
|
||||||
*
|
* @return int
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function channelTimeStamp($channel)
|
public function channelTimeStamp($channel)
|
||||||
{
|
{
|
||||||
|
|
@ -769,11 +777,10 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Check whether sql date is empty.
|
* Check whether sql date is empty.
|
||||||
*
|
*
|
||||||
* @param string $date
|
* @param string $date
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_empty_date($date)
|
public function is_empty_date($date)
|
||||||
{
|
{
|
||||||
return preg_replace('#[ 0:-]#', '', $date) === '';
|
return preg_replace('#[ 0:-]#', '', $date) === '';
|
||||||
}
|
}
|
||||||
|
|
@ -781,10 +788,9 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Format date using current channel.
|
* Format date using current channel.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Support\Carbon|null $date
|
* @param \Illuminate\Support\Carbon|null $date
|
||||||
* @param string $format
|
* @param string $format
|
||||||
*
|
* @return string
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function formatDate($date = null, $format = 'd-m-Y H:i:s')
|
public function formatDate($date = null, $format = 'd-m-Y H:i:s')
|
||||||
{
|
{
|
||||||
|
|
@ -802,10 +808,9 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Retrieve information from payment configuration.
|
* Retrieve information from payment configuration.
|
||||||
*
|
*
|
||||||
* @param string $field
|
* @param string $field
|
||||||
* @param int|string|null $channelId
|
* @param int|string|null $channelId
|
||||||
* @param string|null $locale
|
* @param string|null $locale
|
||||||
*
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getConfigData($field, $channel = null, $locale = null)
|
public function getConfigData($field, $channel = null, $locale = null)
|
||||||
|
|
@ -827,11 +832,11 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $coreConfigValue) {
|
if (! $coreConfigValue) {
|
||||||
$fields = explode(".", $field);
|
$fields = explode('.', $field);
|
||||||
|
|
||||||
array_shift($fields);
|
array_shift($fields);
|
||||||
|
|
||||||
$field = implode(".", $fields);
|
$field = implode('.', $fields);
|
||||||
|
|
||||||
return Config::get($field);
|
return Config::get($field);
|
||||||
}
|
}
|
||||||
|
|
@ -842,8 +847,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Retrieve a group of information from the core config table.
|
* Retrieve a group of information from the core config table.
|
||||||
*
|
*
|
||||||
* @param mixed $criteria
|
* @param mixed $criteria
|
||||||
*
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function retrieveGroupConfig($criteria)
|
public function retrieveGroupConfig($criteria)
|
||||||
|
|
@ -864,8 +868,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Returns country name by code.
|
* Returns country name by code.
|
||||||
*
|
*
|
||||||
* @param string $code
|
* @param string $code
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function country_name($code)
|
public function country_name($code)
|
||||||
|
|
@ -878,8 +881,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Retrieve all country states.
|
* Retrieve all country states.
|
||||||
*
|
*
|
||||||
* @param string $countryCode
|
* @param string $countryCode
|
||||||
*
|
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
public function states($countryCode)
|
public function states($countryCode)
|
||||||
|
|
@ -910,7 +912,7 @@ class Core
|
||||||
*/
|
*/
|
||||||
public function findStateByCountryCode($countryCode = null, $stateCode = null)
|
public function findStateByCountryCode($countryCode = null, $stateCode = null)
|
||||||
{
|
{
|
||||||
$collection = array();
|
$collection = [];
|
||||||
|
|
||||||
$collection = $this->countryStateRepository->findByField(['country_code' => $countryCode, 'code' => $stateCode]);
|
$collection = $this->countryStateRepository->findByField(['country_code' => $countryCode, 'code' => $stateCode]);
|
||||||
|
|
||||||
|
|
@ -924,9 +926,8 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Returns time intervals.
|
* Returns time intervals.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Support\Carbon $startDate
|
* @param \Illuminate\Support\Carbon $startDate
|
||||||
* @param \Illuminate\Support\Carbon $endDate
|
* @param \Illuminate\Support\Carbon $endDate
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTimeInterval($startDate, $endDate)
|
public function getTimeInterval($startDate, $endDate)
|
||||||
|
|
@ -982,9 +983,10 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $date
|
* Week range.
|
||||||
* @param int $day
|
|
||||||
*
|
*
|
||||||
|
* @param string $date
|
||||||
|
* @param int $day
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function xWeekRange($date, $day)
|
public function xWeekRange($date, $day)
|
||||||
|
|
@ -1005,8 +1007,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Method to sort through the acl items and put them in order.
|
* Method to sort through the acl items and put them in order.
|
||||||
*
|
*
|
||||||
* @param array $items
|
* @param array $items
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function sortItems($items)
|
public function sortItems($items)
|
||||||
|
|
@ -1029,8 +1030,9 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $fieldName
|
* Get config field.
|
||||||
*
|
*
|
||||||
|
* @param string $fieldName
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getConfigField($fieldName)
|
public function getConfigField($fieldName)
|
||||||
|
|
@ -1049,8 +1051,9 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $items
|
* Convert to associative array.
|
||||||
*
|
*
|
||||||
|
* @param array $items
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function convertToAssociativeArray($items)
|
public function convertToAssociativeArray($items)
|
||||||
|
|
@ -1083,10 +1086,11 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $items
|
* Array set.
|
||||||
* @param string $key
|
|
||||||
* @param string|int|float $value
|
|
||||||
*
|
*
|
||||||
|
* @param array $items
|
||||||
|
* @param string $key
|
||||||
|
* @param string|int|float $value
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function array_set(&$array, $key, $value)
|
public function array_set(&$array, $key, $value)
|
||||||
|
|
@ -1120,14 +1124,15 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $array1
|
* Convert empty strings to null.
|
||||||
*
|
*
|
||||||
|
* @param array $array1
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function convertEmptyStringsToNull($array)
|
public function convertEmptyStringsToNull($array)
|
||||||
{
|
{
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
if ($value == "" || $value == "null") {
|
if ($value == '' || $value == 'null') {
|
||||||
$array[$key] = null;
|
$array[$key] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1138,8 +1143,7 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Create singleton object through single facade.
|
* Create singleton object through single facade.
|
||||||
*
|
*
|
||||||
* @param string $className
|
* @param string $className
|
||||||
*
|
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function getSingletonInstance($className)
|
public function getSingletonInstance($className)
|
||||||
|
|
@ -1156,13 +1160,12 @@ class Core
|
||||||
/**
|
/**
|
||||||
* Returns a string as selector part for identifying elements in views.
|
* Returns a string as selector part for identifying elements in views.
|
||||||
*
|
*
|
||||||
* @param float $taxRate
|
* @param float $taxRate
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function taxRateAsIdentifier(float $taxRate): string
|
public static function taxRateAsIdentifier(float $taxRate): string
|
||||||
{
|
{
|
||||||
return str_replace('.', '_', (string)$taxRate);
|
return str_replace('.', '_', (string) $taxRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1200,9 +1203,10 @@ class Core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $array1
|
* Array merge.
|
||||||
* @param array $array2
|
|
||||||
*
|
*
|
||||||
|
* @param array $array1
|
||||||
|
* @param array $array2
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function arrayMerge(array &$array1, array &$array2)
|
protected function arrayMerge(array &$array1, array &$array2)
|
||||||
|
|
@ -1222,6 +1226,11 @@ class Core
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get core config values.
|
* Get core config values.
|
||||||
|
*
|
||||||
|
* @param mixed $field
|
||||||
|
* @param mixed $channel
|
||||||
|
* @param mixed $locale
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function getCoreConfigValue($field, $channel, $locale)
|
protected function getCoreConfigValue($field, $channel, $locale)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue