I am trying to use Tatter\Menus and have some very basic questions. I installed Tatter\Menus via Composer at /vendor/tatter and can't figure out how to get the example menu working, MainMenu.php.
Where should I put MainMenu.php - in app/Views? Or somewhere else?
Documentation says "Since Menu is Stringable it can be used in your view or layout files as is. ". If I create a view (eg, TatterExampleView.php), I don't understand how to access MainMenu in the view file to display the menu? I looked at the Spatie page to see if it had any additional guidance and did not see anything.
I really appreciate the work that was done to provide this library.
Code:
<? php
class MainMenu extends \Tatter\Menus\Menu
{
public function __toString(): string
{
return $this->builder
->link(site_url('/'), 'Home')
->link(site_url('/about'), 'About')
->html('<hr>')
->link(site_url('/contact'), 'Contact')
->render();
}
}