StatusHashtagObserver.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Observers;
  3. use App\StatusHashtag;
  4. use App\Services\StatusHashtagService;
  5. class StatusHashtagObserver
  6. {
  7. /**
  8. * Handle the notification "created" event.
  9. *
  10. * @param \App\Notification $notification
  11. * @return void
  12. */
  13. public function created(StatusHashtag $hashtag)
  14. {
  15. StatusHashtagService::set($hashtag->hashtag_id, $hashtag->status_id);
  16. }
  17. /**
  18. * Handle the notification "updated" event.
  19. *
  20. * @param \App\Notification $notification
  21. * @return void
  22. */
  23. public function updated(StatusHashtag $hashtag)
  24. {
  25. StatusHashtagService::set($hashtag->hashtag_id, $hashtag->status_id);
  26. }
  27. /**
  28. * Handle the notification "deleted" event.
  29. *
  30. * @param \App\Notification $notification
  31. * @return void
  32. */
  33. public function deleted(StatusHashtag $hashtag)
  34. {
  35. StatusHashtagService::del($hashtag->hashtag_id, $hashtag->status_id);
  36. }
  37. /**
  38. * Handle the notification "restored" event.
  39. *
  40. * @param \App\Notification $notification
  41. * @return void
  42. */
  43. public function restored(StatusHashtag $hashtag)
  44. {
  45. StatusHashtagService::set($hashtag->hashtag_id, $hashtag->status_id);
  46. }
  47. /**
  48. * Handle the notification "force deleted" event.
  49. *
  50. * @param \App\Notification $notification
  51. * @return void
  52. */
  53. public function forceDeleted(StatusHashtag $hashtag)
  54. {
  55. StatusHashtagService::del($hashtag->hashtag_id, $hashtag->status_id);
  56. }
  57. }