/** * Update stats in DB * * @return void */ public function updateFbStats() { $posts = $this->publishment->orderBy('id', 'DESC')->where('fb_post_id', '!=', '')->get(); foreach ($posts as $key => $post) { $object = $this->facebookContent->fetchFbStats($post); if (isset($object->shares)) { $post->facebook_shares = $object->shares->count; } $post->facebook_likes = $object->likes->summary->total_count; $post->save(); } }
/** * Show start view of publisher * * @return view */ public function index() { $publishments = $this->publishment->orderBy('id', 'DESC')->paginate(5); return view('crm-launcher::publisher.index')->with('publishments', $publishments); }