예제 #1
0
 private function groupStream(Problem $problem, Group $group)
 {
     $user = Auth::user();
     $groupRepository = new GroupRepository();
     $joins = $groupRepository->getAllJoinUsers($group);
     foreach ($joins as $join) {
         Stream::create(['user_id' => $join->id, 'contentable_id' => $problem->id, 'contentable_type' => 'App\\Problem', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]);
     }
     Stream::create(['user_id' => $user->id, 'contentable_id' => $problem->id, 'contentable_type' => 'App\\Problem', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 1]);
 }
예제 #2
0
 private function stream($friendship)
 {
     $friendRepository = new FriendRepository();
     $friends = $friendRepository->myFriends();
     $user = Auth::user();
     foreach ($friends as $friend) {
         Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $friendship->id, 'contentable_type' => 'App\\Friend', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 0]);
     }
     Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $friendship->id, 'contentable_type' => 'App\\Friend', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 1]);
 }
예제 #3
0
 private function stream($recommendation)
 {
     $authUser = Auth::user();
     $user = $recommendation->skill->user;
     $friendRepository = new FriendRepository();
     $friends = $friendRepository->friendsOf($user->id);
     foreach ($friends as $friend) {
         $is_see = 0;
         if ($authUser->id == $friend->friend_info->id) {
             $is_see = 1;
         }
         Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $recommendation->id, 'contentable_type' => 'App\\Recommendation', 'parentable_id' => $authUser->id, 'parentable_type' => 'App\\User', 'is_see' => $is_see]);
     }
     Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $recommendation->id, 'contentable_type' => 'App\\Recommendation', 'parentable_id' => $authUser->id, 'parentable_type' => 'App\\User', 'is_see' => 0]);
 }
예제 #4
0
 /**
  * Created By Dara on 1/11/2015
  * group post stream
  */
 private function groupStream($post, $group)
 {
     $user = Auth::user();
     $groupRepository = new GroupRepository();
     $joins = $groupRepository->getAllJoinUsers($group);
     //return the users of the group except current
     foreach ($joins as $join) {
         Stream::create(['user_id' => $join->id, 'contentable_id' => $post->id, 'contentable_type' => 'App\\Post', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]);
     }
     Stream::create(['user_id' => $user->id, 'contentable_id' => $post->id, 'contentable_type' => 'App\\Post', 'parentable_id' => $group->id, 'parentable_type' => 'App\\Group', 'is_see' => 1]);
 }
예제 #5
0
 private function stream($receivers, $poll)
 {
     foreach ($receivers as $receiver) {
         if ($poll->user_id != $receiver) {
             Stream::create(['user_id' => $receiver, 'edge_ranke' => 0, 'contentable_id' => $poll->id, 'contentable_type' => 'App\\Poll', 'parentable_id' => $poll->user_id, 'parentable_type' => 'App\\User', 'is_see' => 0]);
         }
     }
     Stream::create(['user_id' => $poll->user_id, 'edge_ranke' => 0, 'contentable_id' => $poll->id, 'contentable_type' => 'App\\Poll', 'parentable_id' => $poll->user_id, 'parentable_type' => 'App\\User', 'is_see' => 1]);
 }
예제 #6
0
 public function approvedStream(Showcase $showcase)
 {
     Stream::create(['user_id' => $showcase->user_id, 'contentable_id' => $showcase->id, 'contentable_type' => 'App\\Showcase', 'parentable_id' => $showcase->profile_id, 'parentable_type' => 'App\\User', 'is_see' => 0]);
 }
예제 #7
0
 /**
  * Created By Dara on 1/12/2015
  * create the stream after submitting a corporation
  */
 private function acceptanceStream($corporation, $senderId)
 {
     Stream::create(['user_id' => $senderId, 'edge_rank' => 0, 'contentable_id' => $corporation->id, 'contentable_type' => 'App\\Corporation', 'parentable_id' => $senderId, 'parentable_type' => 'App\\User', 'is_see' => 0]);
 }
예제 #8
0
 private function stream($article)
 {
     $user = Auth::user();
     $friendRepository = new FriendRepository();
     $friends = $friendRepository->myFriends();
     foreach ($friends as $friend) {
         Stream::create(['user_id' => $friend->friend_info->id, 'edge_ranke' => 0, 'contentable_id' => $article->id, 'contentable_type' => 'App\\Article', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 0]);
         Event::fire(new Notification($friend->friend_info->id, 'App\\Article', $article));
     }
     Stream::create(['user_id' => $user->id, 'edge_ranke' => 0, 'contentable_id' => $article->id, 'contentable_type' => 'App\\Article', 'parentable_id' => $user->id, 'parentable_type' => 'App\\User', 'is_see' => 1]);
 }
예제 #9
0
 public function run()
 {
     Stream::create(['streaming' => 0]);
 }
예제 #10
0
 private function groupStream(Comment $comment)
 {
     $user = Auth::user();
     $owner = $comment->commentable->user;
     if ($user->id != $owner->id) {
         Stream::create(['user_id' => $owner->id, 'edge_ranke' => 0, 'contentable_id' => $comment->id, 'contentable_type' => 'App\\Comment', 'parentable_id' => $user->id, 'parentable_type' => 'App\\Group', 'is_see' => 0]);
     }
 }