Added new blade directive moduleIsEnabled
and module_is_enabled
helper function.
This commit is contained in:
parent
4bc8dc08fb
commit
2123bf34cf
@ -29,6 +29,10 @@ class Blade extends ServiceProvider
|
|||||||
return "<?php echo show_widget($expression); ?>";
|
return "<?php echo show_widget($expression); ?>";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Facade::directive('moduleIsEnabled', function ($expression) {
|
||||||
|
return "<?php echo module_is_enabled($expression); ?>";
|
||||||
|
});
|
||||||
|
|
||||||
Facade::if('readonly', function () {
|
Facade::if('readonly', function () {
|
||||||
return config('read-only.enabled');
|
return config('read-only.enabled');
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use App\Models\Common\Company;
|
use App\Models\Common\Company;
|
||||||
use App\Traits\DateTime;
|
use App\Traits\DateTime;
|
||||||
use App\Traits\Sources;
|
use App\Traits\Sources;
|
||||||
|
use App\Traits\Modules;
|
||||||
use App\Utilities\Date;
|
use App\Utilities\Date;
|
||||||
use App\Utilities\Widgets;
|
use App\Utilities\Widgets;
|
||||||
|
|
||||||
@ -88,6 +89,20 @@ if (! function_exists('company')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! function_exists('module_is_enabled')) {
|
||||||
|
/**
|
||||||
|
* Check if a module is enabled.
|
||||||
|
*/
|
||||||
|
function module_is_enabled(string $alias): bool
|
||||||
|
{
|
||||||
|
$module = new class() {
|
||||||
|
use Modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
return $module->moduleIsEnabled($alias);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! function_exists('company_id')) {
|
if (! function_exists('company_id')) {
|
||||||
/**
|
/**
|
||||||
* Get id of current company.
|
* Get id of current company.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user