Level 29
You can use the page props for this
<div class="font-medium">{{ $page.props.auth.user}}</div>
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
My current set-up is I put in the meta but it's not safer... what are the best recommendations for this?
current setup
in app.blade.php
<meta name="user-name" content="{{ auth()->user()->name ?? '' }}">
then in the topbar.vue
const userName = ref('');
onMounted(() => {
userName.value = document.querySelector("meta[name='user-name']").getAttribute('content');
});
then
<li class="p-2">
<div class="font-medium">{{ userName }}</div>
<div class="text-xs text-white/60 mt-0.5 dark:text-slate-500">Admin</div>
</li>
but it's safe right?
You can use the page props for this
<div class="font-medium">{{ $page.props.auth.user}}</div>
Please or to participate in this conversation.