定制 codelets-mongodb/notification 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codelets-mongodb/notification

Composer 安装命令:

composer require codelets-mongodb/notification

包简介

This is a custom notification, for keeping users notifications received in an application internally.

README 文档

README

Makes Laravel Notification a Breeze...


This package is custom notify for both admins and users, so instead of using laravel notification. I built this custom notification package for my projects, so if you want to try it out read through the documentation. This package is based on mongodb

Installing

The recommended way to install codelets-mv/notification is through Composer.

# Install package via composer
composer require codelets-mv/notification

Next, run the Composer command to install the latest stable version of codelets-mv/notification:

# Update package via composer
 composer require codelets-mv/notification --lock

After installing, the package will be auto discovered, But if need you may run:

# run for auto discovery <-- If the package is not detected automatically -->
composer dump-autoload

Then run this, to get the config/mv-notification.php for configurations:

# run this to get the configuartion file at config/mv-notification.php <-- read through it -->
php artisan vendor:publish --provider="MV\Notification\MvNotificationService"

You will have to provide this in the .env for the api configurations:

# This is the pagination number you want to paginate with <-- default(10) -->
MV_NOTIFICATION_PAGINATE=

Usage

Follow the steps below on how to use the package:

  /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct() {
        //The instance should be either this
        $this->middleware('auth:admin');//for your admin controller
        //or
        $this->middleware('auth');//for your user Controller
    }

    /**
     * ---------------------------------
     * Fetch Latest Notification Here
     * --------------------------------
     * Passing bool - true - to the function will query admin notification only
     * @return void
     */
    public function latestNotifications() {
        Mv::latestNotifications();//Fetching latest notification for user
        Mv::latestNotifications(true);//Fetching latest notification for admin
    }

    /**
     * --------------------------------
     * Fetching all notifications
     * -------------------------------
     * Passing bool - true - to the function will query admin notification only
     * @return void
     */
    public function allNotifications() {
        Mv::allNotifications();//Fetching all notifications for user
        Mv::allNotifications(true);//Fetching all notifications for admin
    }

    /**
     * =-------------------------------
     * Deleting a single notification
     * --------------------------------
     * Passing bool - true - to the function will query admin notification only
     * ------------------------------------------------------------------------------
     * To achieve single notification create a route that receives a (string) notification_id
     * Note that this package uses uuids so the notification_id has to be a string
     * ----------------------------------------------------------------------------------------
     * Passing bool - true - to the function will query admin notification only
     * -----------------------------------------------------------------------------------------------
     * @param string $notification_id
     * @return void
     */
    public function deleteSingleNotification(string $notification_id) {
        Mv::deleteSingleNotification($notification_id);//For user
        Mv::deleteSingleNotification($notification_id, true);//For admin
    }

    /**
     * =-------------------------------
     * Deleting a all notification
     * --------------------------------
     * Passing bool - true - to the function will query admin notification only
     * ------------------------------------------------------------------------------
     * Passing bool - true - to the function will query admin notification only
     * ----------------------------------------------------------------------------------
     * @return void
     */
    public function deleteAllNotifications() {
        Mv::deleteAllNotifications();//For user
        Mv::deleteAllNotifications(true);//For admin
    }

    /**
     * --------------------------------
     * Creating new notification here
     * --------------------------------
     * In creating notification we need 4 parameters of which 2 are optional that is for user_id and admin_id
     * -------------------------------------------------------------------------------------------------------
     * Also you can have your function that receives the parameters and passes them to Mv::createSystemNotification
     * --------------------------------------------------------------------------------------------------------------
     * @return void
     */
    public function createSystemNotification() {
        //This is for creating user notifications
        Mv::createSystemNotification(null, auth()->id(), 'My Notification Subject', 'My Notification Message');

        //This is for creating admin notifications
        Mv::createSystemNotification(auth('admin')->id(), null, 'My Notification Subject', 'My Notification Message');
    }


    /**
     * ---------------------------
     * TODO SIMPLE PACKAGE NOTES
     * -----------------------------------------------------------------------------------------
     * For the functions used above can be changed to your own names to call the package names
     * -----------------------------------------------------------------------------------------
     */

Version Guidance

Version Status Packagist Namespace Repo
1.x Latest codelets-mv/notification MV\Notification v1.0.0

Security Vulnerabilities

For any security vulnerabilities, please email to MvTechZone.

License

This package is open-source software licensed under the MIT license.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固