using site()->user()->username() yields nothing a plugin route while being logged into panel. what am i missing?
site()->user()->username()
$kirby->set('route', array( 'pattern' => 'route/test.json', 'action' => function($hash) { $json = ['username' => site()->user()->username()]; // will crash since null return response::json($json); }, ) );
You are using a variable $hash, but it does not make sense because your are not using a placeholder? This is likely causing an error⦠site()->user()->username() is available, a just tested this in a Panel route with f::write()
$hash
f::write()
oh boy. time for a break;. thanks @texnixe for the quick response.
break;