Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to notify user when badge is earned ? #21

Open
bhushan opened this issue Nov 26, 2019 · 0 comments
Open

How to notify user when badge is earned ? #21

bhushan opened this issue Nov 26, 2019 · 0 comments

Comments

@bhushan
Copy link

bhushan commented Nov 26, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant