I have been trying to create a custom controller that extends UserFrosting's BaseController and then call it's method from index.php. Seems simple, but so far I am highly unsuccessful. I am new to UserFrosting, hence I am most likely missing something obvious.
controllers/LGController.php:
<?php
namespace UserFrosting;
class LGController extends \UserFrosting\BaseController {
public function __construct($app){
$this->_app = $app;
}
public function lgRequestsList(){
$groups = array('Luke #1', 'Luke #2');
$this->_app->render('lg-request-list.twig', [
"groups" => $groups
]);
}
}
index.php:
...
use UserFrosting as UF;
$app->get('/lg/requests/?', function () use ($app) {
$controller = new UF\LGController($app);
return $controller->lgRequestsList();
});
...
Error:
[Wed Nov 09 15:25:40 2016] [warn] [client 160.34.126.11] mod_fcgid: stderr: Fatal error (1) in /home2/test/public_html/index.php on line 66: Class 'UserFrosting\\LGController' not found, referer: http://xxx.co.uk/groups/g/1/auth