@poke What do you mean by “anywhere where the user can input things that gets displayed on the website”?
Also, you shouldn’t have a dollar symbol in front of Auth, and the method name is camelCased, i.e. just user() not User().
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So I created a website with Laravel, and I just found out if a user writes {{ $Auth::User() }} and it gets displayed on the website, for example if the user makes his username that then the website breaks.
This is with the default auth scaffolding or in a forum post.
I found out if I remove the line that says <script src="{{ asset('js/app.js') }}"></script> in the main layouts app.blade.php file, then it works fine again.
This points to the file in the public\js folder called app.js
Also if I remove the file and pointer then no JavaScript elements seems to work.
Update (Still not solved):
This seems to be something with Vue in the app.js file trying to read the curly brackets and breaks. This does not seem good if anyone puts in curly brackets they can break your website...
Update 2 (Fixed):
So it was Vue in the default app.js file that took the "un-escaped" strings from either a username or some input from the user in general. Which then get taken by Vue, where it sees curly brackets as something it needs to interpenetrate.
I fixed it by removing the default app.js file and replaced it with my own that support bootstrap.
Thanks for a nice and healthy discussion, I learned something new! :D
You don't have to use the default js file at all. If you're using Bootstrap and that's the only javascript you need, just remove app.js and load jQuery and Bootstrap from a CDN.
Please or to participate in this conversation.