Php 使用队列在laravel中推送android和ios通知
我正在使用Php 使用队列在laravel中推送android和ios通知,php,laravel,push-notification,laravel-5.3,laravel-queue,Php,Laravel,Push Notification,Laravel 5.3,Laravel Queue,我正在使用davidennun/laravel推送通知包向设备发送通知。但我想向多个用户发送通知,以便使用laravel队列。但我不熟悉laravel,这就是为什么我不知道如何使用带有通知的队列 我已经创建了迁移队列表,并通过 php artisan make:job SendPushNotification命令 运行以下命令后 php artisan make:job SendPushNotification 从你的控制器 $user=user::all(); $other_data=arra
davidennun/laravel推送通知
包向设备发送通知。但我想向多个用户发送通知,以便使用laravel队列
。但我不熟悉laravel,这就是为什么我不知道如何使用带有通知的队列
我已经创建了迁移队列表,并通过
php artisan make:job SendPushNotification
命令 运行以下命令后
php artisan make:job SendPushNotification
从你的控制器
$user=user::all();
$other_data=array('message'=>'这是message');
SendPushNotification::dispatch($user,$other_data)代码>
在app\Jobs\SendPushNotification.php中
protected $contacts;
protected $sms_data;
public function __construct($users, $other_data)
{
//
$this->users = $users;
$this->other_data = $other_data;
}
public function handle()
{
$users = $this->users;
$other_data = $this->other_data;
foreach($users as $key => $value){
// You code
}
运行以下命令
php工匠队列:工作