Mud*_*sir 5 php notifications push-notification laravel web-push
我正在使用 webpush 处理通知。我使用此链接来实现通知网络推送。我正在搜索并应用上周的每个解决方案,但同样的问题我安装了 gmp 并在 xampp/etc/php.ini 中添加
extension = mcrypt.so
Run Code Online (Sandbox Code Playgroud)
这是我的代码
class InvoicePaid extends Notification implements ShouldQueue
{
use Queueable;
public $title, $body;
public function __construct($title, $body)
{
//
$this->title = $title;
$this->body = $body;
}
public function via($notifiable)
{
return [WebPushChannel::class];
}
public function toWebPush($notifiable, $notification)
{
$time = \Carbon\Carbon::now();
return WebPushMessage::create()
// ->id($notification->id)
->title($this->title)
->icon(url('/push.png'))
->body($this->body);
//->action('View account', 'view_account');
}
}
Run Code Online (Sandbox Code Playgroud)
我的路线是
Route::post('/send-notification/{id}', function($id, Request $request){
$user = \App\User::findOrFail($id);
$user->notify(new \App\Notifications\GenericNotification($request->title, $request->body));
return response()->json([
'success' => true
]);
});
Run Code Online (Sandbox Code Playgroud)
但是当我发送通知时,我收到了这个错误,请 在此处输入图片描述
这是gmp安装的图片
尝试转到您的xampp/php/ext
文件夹
检查是否php_gmp.dll
存在
打开xampp/php/php.ini
搜索php_gmp
并确保它像extension=php_gmp.dll
而不是;extension=php_gmp.dll
别的
php_gmp.dll
到该文件夹并重试该过程您不应该再次遇到 gmp 问题。
归档时间: |
|
查看次数: |
5042 次 |
最近记录: |