Details

  • View On packagist
  • Created by Nicolas Widart
  • Added on Dec 29, 2015
  • Total Downloads: 3825
  • Monthly Downloads: 162
  • Daily Downloads: 15
  • Favourites: 15

Notification

Module handling (optionally, real time) notifications on your application.

Notification module

Quickly send (real-time) notifications to your AsgardCms application.

$this->notification->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));
/**
  * Push a notification on the dashboard
  * @param string $title
  * @param string $message
  * @param string $icon
  * @param string|null $link
 */
public function push($title, $message, $icon, $link = null);

Notifications demo screenshot Quick demo


Installation

Module Download

Using AsgardCMS's module download command:

php artisan asgard:download:module asgardcms/notification --migrations

This will download the module and run its migrations .

This is the recommended way if you wish to customise the fields, views, etc.

Composer

Execute the following command in your terminal:

composer require asgardcms/notification-module

Publish the configuration

php artisan module:publish notification

Real time ?

If you want real time notifications over websockets, you need to configure the broadcasting.php config file. After that is done, set the asgard.notification.config.real-time option to true.

Currently, Laravel broadcasting supports Pusher and Redis, but AsgardCms only has the front-end integration for Pusher. More integrations are welcome via pull-request. Look at the Pusher integration for inspiration.

Usage

Usage is simple and straightforward:

Inject the Modules\Notification\Services\Notification interface where you need it and assign it to a class variable.

Send notification to logged in user

$this->notification->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));

Send notification to a specific user

$this->notification->to($userId)->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));

Module Download

Install any module with the php artisan asgard:download:module command.

php artisan asgard:download:module asgardcms/notification-module --migrations

This will download the module and run its migrations.

Composer

composer require asgardcms/notification-module

This is if the module is perfect for your use-case as-is, and doesn't need any changes to fit your needs.

Note: Don't forget to give yourself the required permissions before you can view the backend entries.

Mobile Analytics