public static function add($data, $type, $user, $target = 0) { $notif = new \App\Notification(); $notif->type = \App\Notification::$TYPES[$type]; $notif->user()->associate($user); $notif->data = $data; if ($target) { $notif->target_id = $target; } $notif->save(); return $notif; }
<?php $notifications = 0; if (Auth::check()) { $notifications = App\Notification::where('user_id', Auth::user()->id)->where('new', 1)->count(); } ?> <nav class="navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/"><span class="glyphicon glyphicon-music"></span> Team Musique </a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="{{ url('courses/list') }}"> Les cours</a></li> <!-- <li><a href="#">Nos professeurs </a></li> --> <li><a href="{{ url('news') }}">L'actu </a></li> <li><a href="{{ url('articles/list') }}">Articles </a></li> <li><a href="{{ url('announcements/list') }}">Annonces </a></li> <li class="disabled" title="Bientôt disponible..."><a href="#">Événements </a></li> <li title="Bientôt disponible..."><a href="{{ url('bands/list') }}">Les Groupes </a></li> <!-- <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Nous rejoindre <span class="caret"></span></a>
<html lang="en"> <head> <title>Proyeku</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Styles --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" > <!-- Custom CSS --> <link href="{{url('/assets/css/header.css')}}" rel="stylesheet"> </head> <?php if (!Auth::guest()) { $FreelancerInfo = App\FreelancerInfo::where('user_info_id', '=', Auth::user()->id)->get(); $notif = App\Notification::where('user_id', '=', Auth::user()->id)->get(); $read = true; foreach ($notif as $a_notif) { $read = $read && $a_notif->read; } } ?> <body> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <!-- Logo Header --> <a class="navbar-brand" href="{{ url('/') }}"> <img class="hidden-xs" src="{{url('/assets/pictures/logo-md.png')}}"> <img class="visible-xs" src="{{url('/assets/pictures/logo-xs.png')}}" style="margin-left: -10px; margin-top: 10px">