qcod/laravel-gamify

How to notify user when badge is earned ?

bhushan opened this issue · 0 comments

I have emailverified, firstcontribution and so on badges.

now i want to show modal like thing to notify users whenever they earned any badge..

`<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class BadgeEarned extends Notification
{
use Queueable;

protected $badge;

/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct($badge)
{
	$this->badge = $badge;
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
	return ['database'];
}

/**
 * Get the array representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function toArray($notifiable)
{
	return [
		'message' => 'You have earned ' . ${$this->badge->getName()} . ' badge.'
	];
}

}
`

i have created notification, bt i couldnt find proper place to fire this notification because its generic notification whenever any badge is earned i want to show modal using vue for database notification.