2018-12-13 00:23:21 +01:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2018-12-13 00:23:21 +01:00
|
|
|
|
|
|
|
namespace App\Utils\Traits;
|
|
|
|
|
|
|
|
use Nwidart\Modules\Facades\Module;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class MakesMenu
|
|
|
|
* @package App\Utils\Traits
|
|
|
|
*/
|
|
|
|
trait MakesMenu
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds an array of available modules for this view
|
|
|
|
* @param string $entity Class name
|
|
|
|
* @return array of modules
|
|
|
|
*/
|
|
|
|
public function makeEntityTabMenu(string $entity) : array
|
|
|
|
{
|
2018-12-13 00:23:21 +01:00
|
|
|
$tabs = [];
|
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
foreach (Module::getCached() as $module) {
|
|
|
|
if (!$module['sidebar']
|
2018-12-13 00:23:21 +01:00
|
|
|
&& $module['active'] == 1
|
2019-12-30 22:59:12 +01:00
|
|
|
&& in_array(strtolower(class_basename($entity)), $module['views'])) {
|
2018-12-13 00:23:21 +01:00
|
|
|
$tabs[] = $module;
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $tabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds an array items to be presented on the sidebar
|
|
|
|
* @return array menu items
|
|
|
|
*/
|
|
|
|
public function makeSideBarMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|