/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. namespace App\Laravel\Notifications\WishlistViewer;
  3. use App\Laravel\Models\WishlistViewer;
  4. use App\Laravel\Notifications\MainNotification;
  5. use Helper;
  6. class PermissionGrantedNotification extends MainNotification
  7. {
  8. /**
  9. * Create a new notification instance.
  10. *
  11. * @return void
  12. */
  13. public function __construct(WishlistViewer $wishlist_viewer)
  14. {
  15. $owner = $wishlist_viewer->owner ? $wishlist_viewer->owner->name : '';
  16. $wishlist = $wishlist_viewer->wishlist ? $wishlist_viewer->wishlist->title : '';
  17. $thumbnail = $wishlist_viewer->owner ? $wishlist_viewer->owner->getAvatar() : '';
  18. $data = [
  19. 'type' => "WISHLIST",
  20. 'reference_id' => $wishlist_viewer->wishlist_id,
  21. 'title' => Helper::get_response_message("PERMISSION_GRANTED_NOTIFICATION_TITLE"),
  22. 'content' => Helper::get_response_message("PERMISSION_GRANTED_NOTIFICATION_CONTENT", ['name' => $owner, 'wishlist' => $wishlist]),
  23. 'thumbnail' => $thumbnail,
  24. ];
  25. $this->setData($data);
  26. }
  27. }