$guest->notify($waitPreCall)
ため
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class User extends Model
{
//
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'user';
/**
.....
}
通知クラス
namespace App\Notifications;
use App\Channels\PushChannel;
use App\Channels\SmsChannel;
use App\Libraries\Helper;
use App\Waitlists;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
class WaitingPrecall extends Notification implements ShouldBroadcast
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public $message;
public $phone;
public $deviceGuests;
public function _construct()
{
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return $this->sendtype==1?[PushChannel::class]: [PushChannel::class,SmsChannel::class];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toSms($notifiable)
{
$data=Helper::send_message($this->smstext,$this->phone);
return $data;
}
}
関数呼び出しはエラーを取得している理由です、nullを返しています。 notify()
の定義をチェックして、何が起こっているかを確認してください。
しかし、それがあるlaravel機能 –
確かである、そしてあなたは、ソースコードに加えてlaravelサイトに与える –
https://laravel.com/docs/5.3/notifications –