Notify

Notification module for Adminetic Admin Panel

Notification Module for Adminetic Admin Panel

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:

composer require adminetic/notify

Step 2: Database Notification

Publish database notification migration

php artisan notification:table

Step 3: Migrate

Migrate notification table.

php artisan migrate

Step 4: Config

Publish config file

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

Step 5: Notification Bell

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

<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

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()

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

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

Setting configuration for general notification is generated at notification setting

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')

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

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

Last updated