Creating helper trait to get the sidebar class for a module

parent 6fbeb46e
<?php
namespace Modules\Core\Traits;
trait CanGetSidebarClassForModule
{
/**
* @param string $module
* @param string $default
* @return string
*/
public function getSidebarClassForModule($module, $default)
{
if ($this->hasCustomSidebar($module)) {
$class = config("asgard.{$module}.config.custom-sidebar");
if (class_exists($class) === false) {
return $default;
}
return $class;
}
return $default;
}
private function hasCustomSidebar($module)
{
$config = config("asgard.{$module}.config.custom-sidebar");
return $config !== null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment