2017 © Pedro Peláez
 

library laravel-luosimao-sms

luosimao Api for laravel 5.4.*

image

rongself/laravel-luosimao-sms

luosimao Api for laravel 5.4.*

  • Friday, August 18, 2017
  • by rongself
  • Repository
  • 1 Watchers
  • 1 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

螺丝帽短信 Laravel Channel 支持

螺丝帽 短信 Channel for laravel 5.4.*, (*1)

安装

composer require 'rongself/laravel-luosimao-sms'

配置

  • 编辑config/app.php注册provider:
'providers' => [
        Rongself\Luosimao\Providers\LuosimaoSmsProvider::class
],
  • 生成配置文件
php artisan vendor:publish 

编辑config/luosimao-sms.php填入app_key, (*2)

  • 通知模板via中使用Channel
<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Rongself\Luosimao\Channels\SmsChannel;

/**
 * Class ChargeResult
 * @package App\Notifications
 */
class ChargeResult extends Notification 
{

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [SmsChannel::class];
    }

    //定义短信内容
    public function toSmsMessage($notifiable)
    {
        return '验证码:19272【铁壳测试】';
    }
}

  • 自定义电话字段
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;

class User extends Model
{
    use Notifiable;

    //添加getPhone方法返回相应字段
    public function getPhone()
    {
        return $this->Tel;
    }

}

  • 发送
<?php
//发送通知消息
$user = User::find(1);
$message = new ChargeResult();
$user->notify($message);

关于通知消息使用详情参考 laravel官方文档, (*3)

The Versions

18/08 2017

dev-master

9999999-dev

luosimao Api for laravel 5.4.*

  Sources   Download

MIT

The Requires

 

by Avatar rongself

18/08 2017

v0.0.3

0.0.3.0

luosimao Api for laravel 5.4.*

  Sources   Download

MIT

The Requires

 

by Avatar rongself

31/05 2017

v0.0.2

0.0.2.0

luosimao Api for laravel 5.4.*

  Sources   Download

MIT

The Requires

 

by Avatar rongself

31/05 2017

v0.0.1

0.0.1.0

luosimao Api for laravel 5.4.*

  Sources   Download

MIT

The Requires

 

by Avatar rongself