How can i define a global variable such that my current_user method can work were ever i want it to, all i simple need to do is check if there is a current user my example code is below
if (isset($_SESSION['company_id'])) {
$current_user = Companies::find($_SESSION['company_id']);
}
else
{
$current_company = null;
}
how can i use the current user method where ever i want without passing it to my app->render()
method just like in my header.html
{% if current_user %}
hi {{current_user.name}}
{% endif %}