fixed methods
This commit is contained in:
parent
f66a2eb0d9
commit
90d72f2851
|
|
@ -92,27 +92,31 @@ class PluginRepo
|
||||||
/**
|
/**
|
||||||
* 获取所有配送方式
|
* 获取所有配送方式
|
||||||
*/
|
*/
|
||||||
public static function getShippingMethods()
|
public static function getShippingMethods(): array
|
||||||
{
|
{
|
||||||
$allPlugins = self::allPlugins();
|
$allPlugins = self::allPlugins();
|
||||||
return $allPlugins->where('type', 'shipping')->filter(function ($item) {
|
return $allPlugins->where('type', 'shipping')->filter(function ($item) {
|
||||||
$plugin = (new Manager)->getPlugin($item->code);
|
$plugin = (new Manager)->getPlugin($item->code);
|
||||||
$item->plugin = $plugin;
|
if ($plugin) {
|
||||||
|
$item->plugin = $plugin->toArray();
|
||||||
|
}
|
||||||
return $plugin && $plugin->getEnabled();
|
return $plugin && $plugin->getEnabled();
|
||||||
});
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有支付方式
|
* 获取所有支付方式
|
||||||
*/
|
*/
|
||||||
public static function getPaymentMethods()
|
public static function getPaymentMethods(): array
|
||||||
{
|
{
|
||||||
$allPlugins = self::allPlugins();
|
$allPlugins = self::allPlugins();
|
||||||
return $allPlugins->where('type', 'payment')->filter(function ($item) {
|
return $allPlugins->where('type', 'payment')->filter(function ($item) {
|
||||||
$plugin = (new Manager)->getPlugin($item->code);
|
$plugin = (new Manager)->getPlugin($item->code);
|
||||||
$item->plugin = $plugin;
|
if ($plugin) {
|
||||||
|
$item->plugin = $plugin->toArray();
|
||||||
|
}
|
||||||
return $plugin && $plugin->getEnabled();
|
return $plugin && $plugin->getEnabled();
|
||||||
});
|
})->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue