(Update) Bonus Tip Notifications

Attach amount to the notification. (per request).
This commit is contained in:
singularity43
2019-01-25 23:03:08 -05:00
parent a19a75cffd
commit dab2daefe9
3 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -327,7 +327,7 @@ class BonusController extends Controller
$transaction->torrent_id = $torrent->id;
$transaction->save();
$uploader->notify(new NewUploadTip('torrent', $user->username, $torrent));
$uploader->notify(new NewUploadTip('torrent', $user->username, $tip_amount, $torrent));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with($this->toastr->success('Your Tip Was Successfully Applied!', 'Yay!', ['options']));
@@ -383,7 +383,7 @@ class BonusController extends Controller
$transaction->post_id = $post->id;
$transaction->save();
$poster->notify(new NewPostTip('forum', $user->username, $post));
$poster->notify(new NewPostTip('forum', $user->username, $tip_amount, $post));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with($this->toastr->success('Your Tip Was Successfully Applied!', 'Yay!', ['options']));
+4 -2
View File
@@ -25,6 +25,7 @@ class NewPostTip extends Notification implements ShouldQueue
public $type;
public $tipper;
public $post;
public $amount;
/**
* Create a new notification instance.
@@ -33,11 +34,12 @@ class NewPostTip extends Notification implements ShouldQueue
*
* @return void
*/
public function __construct(string $type, string $tipper, Post $post)
public function __construct(string $type, string $tipper, $amount, Post $post)
{
$this->type = $type;
$this->post = $post;
$this->tipper = $tipper;
$this->amount = $amount;
}
/**
@@ -64,7 +66,7 @@ class NewPostTip extends Notification implements ShouldQueue
$appurl = config('app.url');
return [
'title' => $this->tipper.' Has Tipped One Of Your Forum Posts',
'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For A Forum Post',
'body' => $this->tipper.' has tipped one of your Forum posts in '.$this->post->topic->name,
'url' => "/forums/topic/{$this->post->topic->slug}.{$this->post->topic->id}?page={$this->post->getPageNumber()}#post-{$this->post->id}",
];
+5 -3
View File
@@ -25,6 +25,7 @@ class NewUploadTip extends Notification implements ShouldQueue
public $type;
public $tipper;
public $torrent;
public $amount;
/**
* Create a new notification instance.
@@ -33,11 +34,12 @@ class NewUploadTip extends Notification implements ShouldQueue
*
* @return void
*/
public function __construct(string $type, string $tipper, Torrent $torrent)
public function __construct(string $type, string $tipper, $amount, Torrent $torrent)
{
$this->type = $type;
$this->tipper = $tipper;
$this->torrent = $torrent;
$this->amount = $amount;
}
/**
@@ -64,8 +66,8 @@ class NewUploadTip extends Notification implements ShouldQueue
$appurl = config('app.url');
return [
'title' => $this->tipper.' Has Tipped One Of Your Torrent Uploads',
'body' => $this->tipper.' has tipped one of your Torrent Uploads: '.$this->torrent->name,
'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For An Uploaded Torrent',
'body' => $this->tipper.' has tipped one of your Uploaded torrents: '.$this->torrent->name,
'url' => "/torrents/{$this->torrent->slug}.{$this->torrent->id}",
];
}