PHP code example of nova-bi / nova-databoards
1. Go to this page and download the library: Download nova-bi/nova-databoards library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nova-bi / nova-databoards example snippets
use NovaBI\NovaDataboards\NovaDataboards;
public function tools()
{
return [
new NovaDataboards()
];
}
use NovaBI\NovaDataboards\NovaDataboards;
use DigitalCreative\CollapsibleResourceManager\CollapsibleResourceManager;
use DigitalCreative\CollapsibleResourceManager\Resources\Group;
use DigitalCreative\CollapsibleResourceManager\Resources\NovaResource;
use DigitalCreative\CollapsibleResourceManager\Resources\TopLevelResource;
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array
*/
public function tools()
{
$analyticsDataboards = [];
$databoards = \NovaBI\NovaDataboards\Models\Databoard::all();
$analyticsDataboards[] = NovaResource::make(\NovaBI\NovaDataboards\Nova\Databoard::class)->label(__('All Databoards'));
foreach ($databoards as $databoard) {
$analyticsDataboards[] = NovaResource::make(\NovaBI\NovaDataboards\Nova\Databoard::class)->detail($databoard->id)->label($databoard->name);
}
return [
new NovaDataboards(),
new CollapsibleResourceManager([
'navigation' => [
TopLevelResource::make([
'label' => 'Databoards',
'icon' => '<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" class="sidebar-icon"><path d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>',
'resources' => $analyticsDataboards
]),
TopLevelResource::make([
'label' => 'Admin',
'icon' => '<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>',
'resources' => [
\App\Nova\User::class,
Group::make([
'label' => 'Databoard Configuration',
'expanded' => false,
'icon' => '',
'resources' =>
[
\NovaBI\NovaDataboards\Nova\DataboardConfiguration::class,
\NovaBI\NovaDataboards\Nova\Datafilter::class,
\NovaBI\NovaDataboards\Nova\Datawidget::class
]
]
)
]
]),
]
])
];
}