using site()->user()->username() yields nothing a plugin route while being logged into panel. what am i missing? ![]()
$kirby->set('route',
array(
'pattern' => 'route/test.json',
'action' => function($hash) {
$json = ['username' => site()->user()->username()]; // will crash since null
return response::json($json);
},
)
);