Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

show notification in laravel

<!-- Nav Item - Alerts -->
                    <li class="nav-item dropdown no-arrow mx-1">
                        <a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Notifications<i class="fas fa-bell fa-fw"></i>

                            @if(Auth::user()->role_id === 1)
                                <!-- Counter - Alerts -->
                                <span class="badge badge-danger badge-counter">{{ $jobSeekerProfile->unreadNotifications->where('type', 'AppNotificationsInterviewRequestReceived')->count() > 0 ? $jobSeekerProfile->unreadNotifications->count() : '' }}</span>
                            @endif

                            @if(Auth::user()->role_id === 2)
                                <!-- Counter - Alerts -->
                                <span class="badge badge-danger badge-counter">{{ Auth::user()->unreadNotifications->where('type', 'AppNotificationsSendJobSeekerResume')->count() }}</span>
                            @endif
                        </a>
                        <!-- Dropdown - Alerts -->
                        <div class="dropdown-list dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="alertsDropdown">
                            <h6 class="dropdown-header">
                                Notifications
                            </h6>

                            @if(Auth::user()->role_id === 1)
                                @foreach($jobSeekerProfile->unreadNotifications as $notification)
                                    <a class="dropdown-item d-flex align-items-center" href="#">
                                        @include('layouts.partials.notification.'. Str::snake(class_basename($notification->type)))
                                    </a>
                                @endforeach
                            @endif

                            @if(Auth::user()->role_id === 2)
                                @foreach(Auth::user()->unreadNotifications as $notification)
                                    <a class="dropdown-item d-flex align-items-center" href="#">
                                        @include('layouts.partials.notification.'. Str::snake(class_basename($notification->type)))
                                    </a>
                                @endforeach
                            @endif

                            <a class="dropdown-item text-center small text-gray-500" href="#">Show All Alerts</a>
                        </div>
                    </li>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #show #notification #laravel
ADD COMMENT
Topic
Name
5+4 =