$CountPesanBaru = App\Pesan::where('baru', 1)->where('tipe', 'Masuk')->count(); ?> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true"> <i class="entypo-mail"></i> @if ( $CountPesanBaru > 0 ) <span class="badge badge-info badge-pesan">{{ $CountPesanBaru }}</span> @endif </a> <ul class="dropdown-menu"> <?php $Pesan = App\Pesan::where('tipe', 'Masuk')->take(5)->orderBy('baru', 'asc')->orderBy('id', 'desc')->get(); ?> <?php $CountPesan = App\Pesan::where('tipe', 'Masuk')->count(); ?> @if ( $CountPesan > 0 ) <li class="top"> <p class="small"> @if ( $CountPesanBaru > 0 ) <a href="javascript:;" class="pull-right telah-dibaca">Tandai semua telah dibaca</a> Anda mempunyai <strong>{{ $CountPesanBaru }}</strong> pesan baru. @else Semua pesan telah dibaca @endif </p> </li>
public function run() { App\Pesan::truncate(); factory(App\Pesan::class, 20)->create(); }