you can add javascript to your code by using the echo statement and rap all
your javascript between "" and if there is "" in the javascript code
then add \ before any "", and for the php inside rap it with ''
<?php
echo "<script>document.write(\"hello world\")</script>"
?>
<?php
$a = 5;
echo "<script>document.write('$a')</script>"
?>
<?php
$TokenData = Auth::user();
echo "<script type=\"text/javascript\">
localStorage.setItem(\"id\", '$TokenData->id');
localStorage.setItem(\"name\", '$TokenData->name');
localStorage.setItem(\"email\", '$TokenData->email');
</script> ";