Package Data | |
---|---|
Maintainer Username: | Krato1 |
Maintainer Contact: | eric@infinety.es (Eric Lagarda) |
Package Create Date: | 2016-06-24 |
Package Last Update: | 2016-06-25 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:24:29 |
Package Statistics | |
---|---|
Total Downloads: | 9 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
With this package you can send notifications to your model. You can choose if you want users, or whatever model.
Notifications are saved on notifications
and each item of your model can retrieve it. Also you can set each notification as read.
Install via composer: composer require infinety-es\notifications
Then register the service provider in config/app.php
inside providers
array:
Infinety\Notifications\NotificationsServiceProvider::class,
Publish package files:
php artisan vendor:publish --provider="Infinety\Notifications\NotificationsServiceProvider"
Tip: You can also publish only this tags:
config
,views
andmigrations
After modify config\notifications.php
file NotificationTrait
to your model. For example User model:
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Infinety\Notifications\Traits\NotificationTrait;
class User extends Authenticatable
{
use NotificationTrait;
In your browser go to notifications
. Example: www.infinety.app/notifications
.
Default pages are in resources\views\vendor\notifications
. You can view
and create
notifications with a simple interface. You can modify everything.
You can create notifications by artisan
with command:
php artisan notifications:new
You have some options you need to add. If not, the command will ask you. Options are:
--notify[=NOTIFY] A model ID, or all
--subject[=SUBJECT] Notification subject
--message[=MESSAGE] Notification message
--type[=TYPE] Type of notifications defined in config file
/**
* Get All Notifications. Readed or not
*
* @return Eloquent
*/
public function notifications()
This method retrieves all notifications read and not read notifications
/**
* Get not read notifications
*
* @return Eloquent
*/
public function getNotReadNotifications()
This method retrieves not read notifications
/**
* Get read Notifications
*
* @return Eloquent
*/
public function getReadNotifications()
This method retrieves read notifications. It's great if you want to show history.
/**
* Get Count of all Notifications
*
* @return integer
*/
public function getAllNotificationCount()
Get count of all notifications including read and not read.
/**
* Get Count of not read Notifications
*
* @return integer
*/
public function getNotReadNotificationCount()
Get count of all notifications not read.
All contributions (in the form on pull requests, issues and feature-requests) are welcome. See the contributors page for all contributors.
##License
Laravel 5 Notifications is an open-sourced laravel package licensed under the MIT License (MIT). Please see the license file for more information.