<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
use Log1x\Navi\Facades\Navi;
class Navigation extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'partials.header.nav.primary',
];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'primary' => $this->navigation(),
];
}
/**
* Returns the primary navigation.
*
* @return array
*/
public function navigation()
{
if (Navi::build()->isEmpty()) {
return;
}
return Navi::build()->toArray();
}
}
I've registered a nav called 'Primary', added a few items, and assigned as 'Primary' nav.
then in setup:
and in Composers > Navigation:
then in my views:
But menu not displaying.
And even if I just have the following, nothing displays:
I'm using Sage 10.
Any idea what may be wrong?
Thanks.