> For the complete documentation index, see [llms.txt](https://pratikdai404.gitbook.io/adminetic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pratikdai404.gitbook.io/adminetic/addons/notify.md).

# Notify

## Notification Module for Adminetic Admin Panel

<figure><img src="/files/n2oBcbYmuF4jAs4gl5y3" alt=""><figcaption></figcaption></figure>

[![Latest Version on Packagist](https://img.shields.io/packagist/v/adminetic/notify.svg?style=flat-square)](https://packagist.org/packages/adminetic/notify)[![Stars](https://img.shields.io/github/stars/pratiksh404/adminetic-notify)](https://github.com/pratiksh404/adminetic-notify/stargazers) [![Downloads](https://img.shields.io/packagist/dt/adminetic/notify.svg?style=flat-square)](https://packagist.org/packages/adminetic/notify) [![StyleCI](https://github.styleci.io/repos/618407321/shield?branch=main)](https://github.styleci.io/repos/618407321?branch=main) [![License](https://img.shields.io/github/license/pratiksh404/adminetic-notify)](https://pratikdai404.gitbook.io/adminetic/addons/packagist.org/packages/adminetic/notify)

Notification module for Adminetic Admin Panel

**Contains: -**

* Notification Setting Panel
* My Notification Panel
* Notification Bell

## Installation

### **Step 1: Composer Install**

You can install the package via composer:

```bash
composer require adminetic/notify
```

### **Step 2: Database Notification**

Publish database notification migration

```bash
php artisan notification:table
```

### **Step 3: Migrate**

Migrate notification table.

```bash
php artisan migrate
```

### Step 4: Config&#x20;

Publish config file

```
php artisan vendor:publish --tag=notify-config
```

### Step 5: Notification Bell

Place notification bell component to views/admin/layouts/components/header

```html
<div class="nav-right col-8 pull-right right-header p-0">
@livewire('notify.notification-bell')
{{-- Other Codes --}}
 </div>
```

#### Include Adminetic Notification Adapter

In config/adminetic.php, include

```
    // Adapters
    'adapters' => [
        Adminetic\Notify\Adapter\NotifyAdapter::class,
    ],
```

## Configuration File

> ```php
> <?php
>
> return [
>
>     /*
>     |--------------------------------------------------------------------------
>     | Notification Configuration
>     |--------------------------------------------------------------------------
>     */
>     'available_notification_medium_in_system' => ['database', 'mail'],
>
>     /*
>     | OPTIONS:
>     | 'database','mail'
>     */
>     'general_notification_mediums' => ['database', 'mail'],
>
>     /*
>     |--------------------------------------------------------------------------
>     | Default Admin Notification By Role
>     |--------------------------------------------------------------------------
>     */
>     'admin_notification_by_role' => ['superadmin', 'admin'],
>
>     /*
>     |--------------------------------------------------------------------------
>     | Polling Configuration
>     |--------------------------------------------------------------------------
>     | Note pusher will be turned off if polling is turned on
>     */
>     'polling' => true,
>     'polling_intervals' => 10000
> ];
>
> ```

#### Note: Pusher will be turned of if polling is turned on

## Usage

### Default Setting Notification using : generalNotify()

```php
generalNotify([
  'title' => 'Hello',
  'message' => 'Default Notification'
])

```

This notification will go to all admin users by default, if you want custom user notification you can pass the user collection

```php
$users = User::latest()->take(3)->get();
generalNotify([
  'title' => 'Hello',
  'message' => 'Default Notification'
],$users)
```

Setting configuration for general notification is generated at `notification setting`

<figure><img src="/files/JBEZfqYlAo53MmqMNKxN" alt=""><figcaption></figcaption></figure>

### Custom Notification using : notify()

#### Steps :

* Create a notification setting with its name and group
* Configure its default value
* Extract its name to be used on notify() helper function for example if you named the notification setting as "New User Notification" use notify('new\_user\_notification')

```php
notify('new_user_notification',[
  'title' => 'Hello',
  'message' => 'Default Notification'
])
```

### Default Setting Override

Required field **`title`** and **`message`**

Overridable properties are:-

* title
* message
* subject
* action
* color
* type
* severity
* icon
* channels
* audience
* allow\_dismiss
* newest\_on\_top
* mouse\_over
* showProgressBar
* spacing
* timer
* placement\_form
* placement\_align
* delay
* animate\_enter
* animate\_exit

#### Usages

```php
notify('new_user_notification',[
  'title' => 'Hello',
  'message' => 'Default Notification',
  'subject' => 'About Default Notification',
  'action' => GeneralNotification::BROWSE, // BROWSE, READ, EDIT, ADD, DELETE if not don't pass action
  'color' => 'primary', // primary, secondary, warning, info, danger
  'type' => GeneralNotification::BROWSE, // INFO, ALERT, REMINDER, MESSAGE, NEWS REPORT
  'severity' => GeneralNotification::MID, // INSIGNIFICANT, READ, EDIT, ADD DELETE
  'icon' => 'fa fa-bell' // Any fontawesome icon
  'channels' => ['database','mail'],
  'audience' => [1,2,3], // User IDs
  'allow_dismiss' => true // Close Button
  'newest_on_top' => true,
  'mouse_over' => true, // Mouse over close disable
  'showProgressBar' => true,
  'spacing' => 5,
  'timer' => 1000 // In millisecond
  'placement_from' => 'bottom', // Vertical Alignment
  'animate_enter' => 'bounceIn',
  'animate_exit' => 'rubberBand'
])
```

### Screenshots

<div><figure><img src="/files/XFdPXlhUwYIKcS67BrIn" alt=""><figcaption></figcaption></figure> <figure><img src="/files/90xRP1SgCqy9ELP9x0Nz" alt=""><figcaption></figcaption></figure> <figure><img src="/files/kasz4AEeYpyuJmbNaDrC" alt=""><figcaption></figcaption></figure> <figure><img src="/files/DPigYqb9R7Xrx4YDRA0R" alt=""><figcaption></figcaption></figure></div>

![Notification Setting](https://github.com/pratiksh404/adminetic-notify/blob/main/screenshots/notification_setting.jpg) ![My Notification](https://github.com/pratiksh404/adminetic-notify/blob/main/screenshots/my_notification.jpg) ![Notification Bell](https://github.com/pratiksh404/adminetic-notify/blob/main/screenshots/notification_bell.jpg)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pratikdai404.gitbook.io/adminetic/addons/notify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
