I'm trying to build a page in Slim that will bring up a subscribers details. I've worked out how to create the route and the relevant method in the controller which all works correctly. I'm using Twig for the views and can't work out how I would access the subscriber from the view.
Route
$app->get('/subscriber/{id}', 'SubscriberController:getSubscriber');
Subscriber controller
public function getSubscriber($request, $response, $args)
{
$subscriber = Subscriber::where('id', $args['id'])->first();
}
I've been using the below in my controller to render my Twig templates
return $this->container->view->render($response, 'subscriber.twig');
How would I pass in or access my subscriber variable in the Twig template? I can't work out how to pass it through?