mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-06 13:26:05 -06:00
#2245 Add points-module as payment method
This commit is contained in:
parent
bebc6f0064
commit
e80f9b9cb0
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,9 +2,18 @@
|
|||||||
|
|
||||||
use Illuminate\Contracts\Bus\Dispatcher;
|
use Illuminate\Contracts\Bus\Dispatcher;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
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()) {
|
function fullLink($request, $url, $newParameters = array()) {
|
||||||
return app(Dispatcher::class)->dispatch(new appendRequestURL($request, $url, $newParameters));
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user