Hello,
So this is my second site with sage and everything is going mostly fine until I try adding a new controller for a new template.
The template file name is template-alphabetical-list.blade.php and the controller file name is TemplateAlphabeticalList.php
The classname within the template is the same as the filename:
class TemplateAlphabeticalList extends Controller
When I add this file I get the following error:
Fatal error: Uncaught ReflectionException: Class App\Controllers\TemplateAlphabeticalList does not exist in /var/www/public/vex/wp-content/themes/VEX/vendor/soberwp/controller/src/Loader.php:121
Stack trace: #0 /var/www/public/vex/wp-content/themes/VEX/vendor/soberwp/controller/src/Loader.php(121): ReflectionClass->__construct('App\\Controllers...')
#1 /var/www/public/vex/wp-content/themes/VEX/vendor/soberwp/controller/src/Loader.php(49): Sober\Controller\Loader->setClassesAlias()
#2 /var/www/public/vex/wp-content/themes/VEX/vendor/soberwp/controller/controller.php(41): Sober\Controller\Loader->__construct(Object(Brain\Hierarchy\Hierarchy))
#3 /var/www/public/vex/wp-includes/class-wp-hook.php(286): Sober\Controller\loader('')
#4 /var/www/public/vex/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#5 /var/www/public/vex/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#6 /var/www/public/vex/wp-settings.php(525): do_action('init')
#7 /var/www/public/vex/wp-config.php(90): require_once('/var/www/ in /var/www/public/vex/wp-content/themes/VEX/vendor/soberwp/controller/src/Loader.php on line 121
The thing is this is exactly how I would create and use controllers the first time round…why is this different?
Do I need to declare the controller somewhere now or something?
EDIT: One this to note that I only just thought of that is different now and before is that with the first site I ran the initial composer command to install the theme from within my virtual box and this time round I have since installed composer on my machine so called composer locally instead if within the virtual machine?
Do any composer commands have to be run from the server?
Additional information. My operating system is mac os mojave and I am using scotchbox as a local vagrant development server.