Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

orchidsoftware/platform

4733 stars
4 code files
View orchidsoftware/platform on GitHub

resources/views/components/notification.blade.php

Open in GitHub
<div class="ms-auto" data-turbolinks-permanent>
<a href="{{ route('platform.notifications') }}"
class="nav-link p-0 d-flex align-items-center"
data-controller="notification"
data-notification-count="{{ count($notifications) }}"
data-notification-url="{{ route('platform.api.notifications') }}"
data-notification-method="post"
data-notification-interval="{{ config('platform.notifications.interval') }}"
>
<x-orchid-icon path="bell"/>
 
<template id="notification-circle">
<x-orchid-icon path="circle" width="0.5em" height="0.5em" />
</template>
 
<span class="badge badge-sm up bg-danger text-white" data-notification-target="badge"></span>
</a>
</div>

resources/views/partials/profile.blade.php

Open in GitHub
<div class="d-flex m-0 align-items-center p-3">
//
<x-orchid-notification/>
</div>

src/Platform/Providers/FoundationServiceProvider.php

Open in GitHub
use Illuminate\Support\ServiceProvider;
use Orchid\Platform\Components\Notification;
 
class FoundationServiceProvider extends ServiceProvider
{
public function register(): void
{
//
Blade::component('orchid-notification', Notification::class);
}
}

src/Platform/Components/Notification.php

Open in GitHub
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use Illuminate\View\Component;
use Orchid\Platform\Notifications\DashboardMessage;
 
class Notification extends Component
{
public $notifications;
 
public function __construct(Request $request)
{
$this->notifications = $request->user()
->unreadNotifications()
->where('type', DashboardMessage::class)
->limit(15)
->get();
}
 
public function render()
{
return view('platform::components.notification');
}
 
public function shouldRender()
{
return config('platform.notifications.enabled', true);
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.