I am working on notification using webpush. i used this link to implement notificaton web push.I am searching and applying every solution from last week but same problem I installed gmp and i added in xampp/etc/php.ini
extension = mcrypt.so
This is my code
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');
}
}
My route is
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
]);
});
But when i send notification i got this error enter image description here
This is picture of gmp installation
Ubuntu 18.04, PHP 7.4. Solved by following commands:
Try to go to your xampp/php/ext
folder
check if php_gmp.dll
exists
open xampp/php/php.ini
search for php_gmp
and make sure it's like extension=php_gmp.dll
instead of ;extension=php_gmp.dll
else
php_gmp.dll
to the folder and try the procedure againYou should not have gmp issue again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With