¨4.0.1¨
This commit is contained in:
@@ -2,19 +2,21 @@
|
||||
|
||||
namespace Modules\Shipping\Facades;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Modules\Shipping\ShippingMethodManager;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Support\Collection available()
|
||||
* @method static \Illuminate\Support\Collection all()
|
||||
* @method static Collection available()
|
||||
* @method static Collection all()
|
||||
* @method static array names()
|
||||
* @method static object get(string $name)
|
||||
* @method static \Modules\Shipping\ShippingMethodManager register(string $name, callable|object $driver)
|
||||
* @method static ShippingMethodManager register(string $name, callable|object $driver)
|
||||
* @method static int count()
|
||||
* @method static bool isEmpty()
|
||||
* @method static bool isNotEmpty()
|
||||
*
|
||||
* @see \Modules\Shipping\ShippingMethodManager
|
||||
* @see ShippingMethodManager
|
||||
*/
|
||||
class ShippingMethod extends Facade
|
||||
{
|
||||
@@ -23,8 +25,8 @@ class ShippingMethod extends Facade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return \Modules\Shipping\ShippingMethodManager::class;
|
||||
return ShippingMethodManager::class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class Method
|
||||
public $label;
|
||||
public $cost;
|
||||
|
||||
|
||||
public function __construct($name, $label, $cost)
|
||||
{
|
||||
$this->name = $name;
|
||||
@@ -18,6 +19,7 @@ class Method
|
||||
$this->cost = Money::inDefaultCurrency($cost);
|
||||
}
|
||||
|
||||
|
||||
public function available()
|
||||
{
|
||||
if ($this->name !== 'free_shipping') {
|
||||
@@ -27,6 +29,7 @@ class Method
|
||||
return $this->freeShippingMethodIsAvailable();
|
||||
}
|
||||
|
||||
|
||||
private function freeShippingMethodIsAvailable()
|
||||
{
|
||||
$minimumAmount = Money::inDefaultCurrency(setting('free_shipping_min_amount'));
|
||||
|
||||
@@ -13,9 +13,9 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
if (! config('app.installed')) {
|
||||
if (!config('app.installed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,10 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
$this->registerFlatRate();
|
||||
}
|
||||
|
||||
|
||||
private function registerFreeShipping()
|
||||
{
|
||||
if (! setting('free_shipping_enabled')) {
|
||||
if (!setting('free_shipping_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,9 +36,10 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function registerLocalPickup()
|
||||
{
|
||||
if (! setting('local_pickup_enabled')) {
|
||||
if (!setting('local_pickup_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,9 +48,10 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function registerFlatRate()
|
||||
{
|
||||
if (! setting('flat_rate_enabled')) {
|
||||
if (!setting('flat_rate_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user