Front-end template layout.blade.php page part code:
<nav>{{ $message }}</nav>
<p class="container"> @yield('content') </p>
<footer></footer>
Other pages inherit this page.
How to pass the message data in nav from the background? Is it passed once in the controller of each content page? This seems very troublesome; another question, how to use Auth::user()->id in the boot() method of AppServiceProvider to obtain the id of the currently logged in user in various ways?
$message You can directly write php statement query in {{}} of blade template. For example:
Message::first() or Message::where()... and the like.
The ID of the currently logged in user can also be written directly in the blade