Sorry for necroposting but I can’t figure this same problem out. I checked the linked controller docs and I think I followed everything, still can’t make it work.
I have a custom template with the filename of template-custom.blade.php. This is also set as my front page currently.
I set up a controller file called template-custom.php. Here is the content:
<?php
namespace App;
use Sober\Controller\Controller;
class TemplateCustom extends Controller
{
public function AnotherTest()
{
return 'eh';
}
}
I used camelcase as you can see, but still get the Undefined variable: another_test error. when I call it in the view file like this:
{{$another_test}}
Now if I put this AnotherTest function in one of the premade controllers, like app.php or front-page.php it works. If I make some another simple controller file, like page or home, it doesn’t, even though I have those classes in the body for this page. Also, there is no front-page class but that controller still works so I’m not sure if I entirely get this body class based checking.
What did I miss here, do I need to include these new controllers in one of the setup/config files?
Thanks in advance. Greatly appreciated.