2018-12-13 00:23:21 +01:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2019-05-11 05:32:07 +02:00
|
|
|
*/
|
2018-12-13 00:23:21 +01:00
|
|
|
|
|
|
|
namespace App\Utils\Traits;
|
|
|
|
|
|
|
|
use Nwidart\Modules\Facades\Module;
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Class MakesMenu.
|
2018-12-13 00:23:21 +01:00
|
|
|
*/
|
|
|
|
trait MakesMenu
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Builds an array of available modules for this view.
|
2019-12-30 22:59:12 +01:00
|
|
|
* @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) {
|
2020-09-06 11:38:10 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Builds an array items to be presented on the sidebar.
|
2020-10-28 11:10:49 +01:00
|
|
|
* @return void menu items
|
2019-12-30 22:59:12 +01:00
|
|
|
*/
|
|
|
|
public function makeSideBarMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|