how do I call the controller method inside the view?

0

I have this method:

public function Menu()
{

    $tabelas = $this->menu->All();

    $menus ="<ul><li>";

    foreach ($tabelas as $tabela )
    {
        if ($tabela->active == !false)
        { 
          //  $return = $this->categoria->All();

            foreach ($tabela as $key => $value )
            {

                if($key->active == !false)
                {
                    $menus .="<li>{$key} <a href= ></a></li> ";
                }
            }   
        }

        $menus.= "</li></ul>";
    }
    return $menus ;
}

I would like to know how to call him in the view, to see how he is returning and setting things up ...

public function create()
{
    $this->setPageTitle('Menu');
    echo  $this->categoria->Menu(); die;
    $this->renderView('rotas/RouteMenus', 'layoutForm');
}
Uncaught Error: Call to a member function Menu () on null

    
asked by anonymous 20.07.2017 / 15:12

0 answers