PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/app/Laravel/Notifications/WishlistViewer/PermissionGrantedNotification.php

https://bitbucket.org/cityserv/techreportph
PHP | 33 lines | 22 code | 6 blank | 5 comment | 0 complexity | da0266ac2cc985df72719c21c8f8cc98 MD5 | raw file
 1<?php
 2
 3namespace App\Laravel\Notifications\WishlistViewer;
 4
 5use App\Laravel\Models\WishlistViewer;
 6use App\Laravel\Notifications\MainNotification;
 7use Helper;
 8
 9class PermissionGrantedNotification extends MainNotification
10{
11
12    /**
13     * Create a new notification instance.
14     *
15     * @return void
16     */
17    public function __construct(WishlistViewer $wishlist_viewer)
18    {
19        $owner = $wishlist_viewer->owner ? $wishlist_viewer->owner->name : '';
20        $wishlist = $wishlist_viewer->wishlist ? $wishlist_viewer->wishlist->title : '';
21        $thumbnail = $wishlist_viewer->owner ? $wishlist_viewer->owner->getAvatar() : '';
22
23        $data = [
24            'type' => "WISHLIST",
25            'reference_id' => $wishlist_viewer->wishlist_id,
26            'title' => Helper::get_response_message("PERMISSION_GRANTED_NOTIFICATION_TITLE"),
27            'content' => Helper::get_response_message("PERMISSION_GRANTED_NOTIFICATION_CONTENT", ['name' => $owner, 'wishlist' => $wishlist]),
28            'thumbnail' => $thumbnail,
29        ];
30
31        $this->setData($data);
32    }
33}