#2245 Add points-module as payment method

This commit is contained in:
Diatrex 2020-10-08 13:56:38 +03:00
parent bebc6f0064
commit e80f9b9cb0
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,23 @@
<?php namespace Visiosoft\AdvsModule\Support\Command;
use Anomaly\Streams\Platform\Addon\Module\Contract\ModuleRepositoryInterface;
class CheckModuleInstalled
{
protected $moduleNamespace;
protected $checkEnabled;
public function __construct($moduleNamespace, $checkEnabled = true)
{
$this->moduleNamespace = $moduleNamespace;
$this->checkEnabled = $checkEnabled;
}
public function handle(ModuleRepositoryInterface $moduleRepository)
{
if ($module = $moduleRepository->findBy('namespace', $this->moduleNamespace)) {
return $this->checkEnabled ? $module->installed && $module->enabled : boolval($module->installed);
}
return false;
}
}

View File

@ -2,9 +2,18 @@
use Illuminate\Contracts\Bus\Dispatcher;
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
use Visiosoft\AdvsModule\Support\Command\CheckModuleInstalled;
if (!function_exists('fullLink')) {
if (!function_exists('fullLink'))
{
function fullLink($request, $url, $newParameters = array()) {
return app(Dispatcher::class)->dispatch(new appendRequestURL($request, $url, $newParameters));
}
}
if (!function_exists('is_module_installed'))
{
function is_module_installed($moduleNamespace, $checkEnabled = true) {
return dispatch_now(new CheckModuleInstalled($moduleNamespace, $checkEnabled));
}
}