public function collectPosts() { $newestPost = $this->message->getNewestPostDate(); $posts = $this->facebookContent->fetchPosts($newestPost); foreach ($posts->data as $key => $post) { $contact = $this->contact->createContact('facebook', $post); $case = $this->case->createCase('facebook_post', $post, $contact); $message = new Message(); $message->contact_id = $contact->id; $message->fb_post_id = $post->id; $message->case_id = $case->id; if (isset($post->message)) { $message->message = $post->message; } $message->post_date = changeFbDateFormat($post->created_time); $message->save(); $this->media->handleMedia($message->id, $post, 'facebook'); } $newestComment = latestCommentDate(); $newestInnerComment = $this->innerComment->LatestInnerCommentDate(); $this->fetchComments($newestComment); $this->fetchInnerComments($newestInnerComment); }
/** * Execute the console command. * * @return mixed */ public function handle() { if (isFacebookLinked()) { $this->update->collectPrivateConversations(); $this->update->collectPosts(); } if (isTwitterLinked()) { $this->update->collectMentions(); $this->update->collectDirectMessages(); } $this->log->updateLog('fetching'); }