I have a really simple question, Its about how I can return a value to many views in laravel, or just make it global so i can use it in many views. I'll explain more, I have a function in the Message Controller that render the messages from database to a view page called message.blade.php
public function index(){
$listmsg = Message::where('idReceiver', Auth::id())->orderBy('idMess','desc')->get();
return view('message', ['messages' => $listmsg]);
}
And on my master page ( app.blade.php ), I have a menu, in this menu I want to display the number of the unread messages, I tried this even I know it's impossible because my function return to the message.blade.php
@if(!$messages->isEmpty())
<span class="badge badge-danger badge-pill">
</span>
@endif
Notice that the message.blade.php extends the master page. Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire