Laravel 通知通道
我收到此错误,我该怎么办? 实在找不到我想念的东西。
未定义函数 App\Console\Commands\Notify
这是命令:
public function handle()
{
$user = DB::table('users')
->whereIn('role',['athlete'])
->andWhere('contact_number');
$user = notify(new SendSMS);
}
}
通知:
public function via($notifiable)
{
return [TwilioChannel::class];
}
public function toTwilio($notifiable)
{
return (new TwilioSmsMessage())
->content("Hi {$notifiable->first_name}. Your account was approved!");
}
}
谢谢!
I am getting this error, what should i do?
Can't really find what I miss.
Undefined function App\Console\Commands\Notify
Here is the command:
public function handle()
{
$user = DB::table('users')
->whereIn('role',['athlete'])
->andWhere('contact_number');
$user = notify(new SendSMS);
}
}
The notification:
public function via($notifiable)
{
return [TwilioChannel::class];
}
public function toTwilio($notifiable)
{
return (new TwilioSmsMessage())
->content("Hi {$notifiable->first_name}. Your account was approved!");
}
}
Thank you!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
notify
是Notifying
特征的一种方法,你也不能从数据库查询中调用通知,你应该使用你的 Eloquent 模型,也您需要将
Notifying
添加到您的User
模型示例:
我希望它有帮助
notify
is a method of theNotifiable
trait, also you cant call notify from the DB query you should use your Eloquent Model, alsoyou need to add
Notifiable
to yourUser
modelExample :
I hope it's helpful