示例#1
0
 /**
  * Handle the event.
  *
  * @param  UserWroteProfilePost  $event
  * @return void
  */
 public function handle(UserWroteProfilePost $event)
 {
     //
     $user = $event->getUser();
     $responsibleUser = $event->getResponsibleUser();
     $body = $event->getBody();
     $this->profilePost->create(array('from_user_id' => $responsibleUser->getId(), 'to_user_id' => $user->getId(), 'body' => $body));
 }
 /**
  * Handle the event.
  *
  * @param  UserWroteProfilePost  $event
  * @return void
  */
 public function handle(UserWroteProfilePost $event)
 {
     //
     $responsibleUser = $event->getResponsibleUser();
     $user = $event->getUser();
     if ($responsibleUser->getId() != $user->getId()) {
         $user->notifications()->create(array('subject_id' => $responsibleUser->getId(), 'subject_type' => get_class($responsibleUser), 'name' => 'post_on_your_profile', 'user_id' => $user->getId(), 'sender_id' => $responsibleUser->getId(), 'is_read' => 0));
     }
 }