/**
  * [Handle the command]
  * @param  [type] $command [description]
  * @return [type]          [description]
  */
 public function handle($command)
 {
     $update = Update::publish($command->userId, $command->type, $command->postId);
     $this->updateRepository->save($update);
     $this->dispatchEventsFor($update);
     return $update;
 }
Example #2
0
 public static function MyFriendsUpdatesRecent($user)
 {
     $recent = Carbon::now()->subMinutes(59);
     //$result = DB::table('db_user')->where('id_user','=',Session::get('id_user'))->where('last_activity','>=',$formatted_date)->get();
     return Update::orderBy('created_at', 'desc')->where('created_at', '>=', $recent)->where('user_id', '!=', $user)->simplePaginate(10);
     // $updates = Update::all();
     // $mixed = array();
     // foreach($updates as $update){
     //    if(checkFriendship($user,$update->user_id)){
     //    	 switch($update->type){
     // 		case 'status':
     // 				       $status = Status::where('id',$update->post_id)->first();
     // 				       $mixed['body'] = $status->body;
     // 				       break;
     // 	    default:       break;
     // 	}
     //    }
     // }
     // return $mixed;
 }
Example #3
0
function getUpdateObject($type, $user, $postId)
{
    return Update::where('user_id', $user)->where('type', $type)->where('post_id', $postId)->first();
}
Example #4
0
 /**
  * Save a new status for user
  * @param  Status $status [description]
  * @param  [type] $userId [description]
  * @return [type]         [description]
  */
 public function save(Update $update)
 {
     return $update->save();
 }