Removed propaganistas/laravel-intl dependency

This commit is contained in:
jitendra 2019-06-27 13:01:47 +05:30
parent 0102dd0c30
commit 2a5e8b1ddd
16 changed files with 46 additions and 32 deletions

View File

@ -29,7 +29,6 @@
"maatwebsite/excel": "3.1.x-dev",
"nwidart/laravel-modules": "^3.2",
"prettus/l5-repository": "^2.6",
"propaganistas/laravel-intl": "^2.0",
"tymon/jwt-auth": "dev-develop"
},
"require-dev": {

View File

@ -203,7 +203,6 @@ return [
*/
Dimsav\Translatable\TranslatableServiceProvider::class,
Propaganistas\LaravelIntl\IntlServiceProvider::class,
/*
* Application Service Providers...

View File

@ -22,7 +22,7 @@ class CartAddress extends JsonResource
'email' => $this->email,
'address1' => explode(PHP_EOL, $this->address1),
'country' => $this->country,
'country_name' => country()->name($this->country),
'country_name' => core()->country_name($this->country),
'state' => $this->state,
'city' => $this->city,
'postcode' => $this->postcode,

View File

@ -18,7 +18,7 @@ class CustomerAddress extends JsonResource
'id' => $this->id,
'address1' => explode(PHP_EOL, $this->address1),
'country' => $this->country,
'country_name' => country()->name($this->country),
'country_name' => core()->country_name($this->country),
'state' => $this->state,
'city' => $this->city,
'postcode' => $this->postcode,

View File

@ -21,7 +21,7 @@ class OrderAddress extends JsonResource
'last_name' => $this->last_name,
'address1' => explode(PHP_EOL, $this->address1),
'country' => $this->country,
'country_name' => country()->name($this->country),
'country_name' => core()->country_name($this->country),
'state' => $this->state,
'city' => $this->city,
'postcode' => $this->postcode,

View File

@ -2,5 +2,5 @@
{{ $address->address1 }}</br>
{{ $address->city }}</br>
{{ $address->state }}</br>
{{ country()->name($address->country) }} {{ $address->postcode }}</br></br>
{{ core()->country_name($address->country) }} {{ $address->postcode }}</br></br>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $address->phone }}

View File

@ -114,7 +114,7 @@
<p>{{ $invoice->order->billing_address->address1 }}</p>
<p>{{ $invoice->order->billing_address->city }}</p>
<p>{{ $invoice->order->billing_address->state }}</p>
<p>{{ country()->name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
<p>{{ core()->country_name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->billing_address->phone }}
</td>
<td>
@ -122,7 +122,7 @@
<p>{{ $invoice->order->shipping_address->address1 }}</p>
<p>{{ $invoice->order->shipping_address->city }}</p>
<p>{{ $invoice->order->shipping_address->state }}</p>
<p>{{ country()->name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
<p>{{ core()->country_name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->shipping_address->phone }}
</td>
</tr>

View File

@ -394,9 +394,9 @@ class Core
if (is_null($amount))
$amount = 0;
$currencyCode = $this->getCurrentCurrency()->code;
$formater = new \NumberFormatter( app()->getLocale(), \NumberFormatter::CURRENCY );
return currency($this->convertPrice($amount), $currencyCode);
return $formater->formatCurrency($this->convertPrice($amount), $this->getCurrentCurrency()->code);
}
/**
@ -407,11 +407,10 @@ class Core
*/
public function currencySymbol($code)
{
try {
return currency()->symbol($code);
} catch (\Exception $e) {
return $code;
}
$formatter = new \NumberFormatter(app()->getLocale() . '@currency=' . $code, \NumberFormatter::CURRENCY);
return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
}
/**
@ -425,7 +424,9 @@ class Core
if (is_null($price))
$price = 0;
return currency($price, $currencyCode);
$formater = new \NumberFormatter( app()->getLocale(), \NumberFormatter::CURRENCY );
return $formater->formatCurrency($price, $currencyCode);
}
/**
@ -438,8 +439,10 @@ class Core
{
if (is_null($price))
$price = 0;
$formater = new \NumberFormatter( app()->getLocale(), \NumberFormatter::CURRENCY );
return currency($price, $this->getBaseCurrencyCode());
return $formater->formatCurrency($price, $this->getBaseCurrencyCode());
}
/**
@ -616,6 +619,19 @@ class Core
return $this->countryRepository->all();
}
/**
* Returns country name by code
*
* @param string $code
* @return string
*/
public function country_name($code)
{
$country = $this->countryRepository->findOneByField('code', $code);
return $country ? $country->name : '';
}
/**
* Retrieve all country states
*

View File

@ -19,7 +19,7 @@
{{ $billingAddress->address1 }},<br/> {{ $billingAddress->state }}
</li>
<li class="mb-10">
{{ country()->name($billingAddress->country) }} {{ $billingAddress->postcode }}
{{ core()->country_name($billingAddress->country) }} {{ $billingAddress->postcode }}
</li>
<span class="horizontal-rule mb-15 mt-15"></span>
@ -47,7 +47,7 @@
{{ $shippingAddress->address1 }},<br/> {{ $shippingAddress->state }}
</li>
<li class="mb-10">
{{ country()->name($shippingAddress->country) }} {{ $shippingAddress->postcode }}
{{ core()->country_name($shippingAddress->country) }} {{ $shippingAddress->postcode }}
</li>
<span class="horizontal-rule mb-15 mt-15"></span>

View File

@ -57,7 +57,7 @@
</li>
<li class="mt-5">
{{ country()->name($address->country) }} {{ $address->postcode }}
{{ core()->country_name($address->country) }} {{ $address->postcode }}
</li>
<li class="mt-10">

View File

@ -114,7 +114,7 @@
<p>{{ $invoice->order->billing_address->address1 }}</p>
<p>{{ $invoice->order->billing_address->city }}</p>
<p>{{ $invoice->order->billing_address->state }}</p>
<p>{{ country()->name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
<p>{{ core()->country_name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
{{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->billing_address->phone }}
</td>
<td>
@ -122,7 +122,7 @@
<p>{{ $invoice->order->shipping_address->address1 }}</p>
<p>{{ $invoice->order->shipping_address->city }}</p>
<p>{{ $invoice->order->shipping_address->state }}</p>
<p>{{ country()->name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
<p>{{ core()->country_name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
{{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->shipping_address->phone }}
</td>
</tr>

View File

@ -43,7 +43,7 @@
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
{{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
@ -75,7 +75,7 @@
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
{{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>

View File

@ -44,7 +44,7 @@
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
{{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
@ -86,7 +86,7 @@
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
{{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>

View File

@ -45,7 +45,7 @@
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
{{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
@ -77,7 +77,7 @@
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
{{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>

View File

@ -43,7 +43,7 @@
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
{{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
@ -75,7 +75,7 @@
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
{{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>

View File

@ -45,7 +45,7 @@
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
{{ core()->country_name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
@ -87,7 +87,7 @@
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
{{ core()->country_name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>