hotrush/laravel-log-notification-channel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

hotrush/laravel-log-notification-channel

最新稳定版本:0.4.0

Composer 安装命令:

composer require hotrush/laravel-log-notification-channel

包简介

Log notifications channel for laravel

README 文档

README

Latest Version on Packagist Software License Total Downloads

Send notifications into log with Laravel, easier to pretend other services e.g. sms or push notifications.

Contents

Installation

composer require hotrush/laravel-log-notification-channel

Setting up the log service

You can add LOG_NOTIFICATIONS_CHANNEL into your .env file to customize log channel to use, otherwise default one will be used.

Usage

<?php

namespace App\Notifications;

use App\Post;
use Illuminate\Notifications\Notification;
use NotificationChannels\Log\LogChannel;
use NotificationChannels\Twilio\TwilioChannel;
use NotificationChannels\Log\LogMessage;


class AuthCodeCreatedNotification extends Notification
{
    /**
     * @var Post
     */
    private $post;

    /**
     * Create a new notification instance.
     *
     * @param Post $post
     * @return void
     */
    public function __construct(Post $post)
    {
        $this->post = $post;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return app()->environment('production')
            ? [TwilioChannel::class]
            : [LogChannel::class];
    }

    /**
     * Get the log message representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return LogMessage
     */
    public function toLog($notifiable)
    {
        return new LogMessage('Pretended sms send to :number and with content: :content');
    }
}

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-25