I want use from $unreadMessages in my layout pages but I don't know which controller is for layouts pages. Hello, I want to use the $unreadMessages variable defined in the layouts page, it is in dashboardController, but This error appear:
Undefined variable: unreadMessages (View: /myhost/resources/views/layouts/app.blade.php) (View: / myhost /resources/views/layouts/app.blade.php)
In which controller can I define this variable so I can use it in layouts?
And this code is for $unreadMessages in dashboardController:
class DashboardController extends Controller
{
public function index()
{
\Artisan::call('status:check');
$unreadMessages = TicketMessage::where(['is_read' => 0])->whereIn('ticket_id', $ticketIds)->whereNotIn('user_id', [Auth::user()->id])->count();
return view('dashboard', compact(
'unreadMessages'
));
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire