/** * Store or update list fanpage * @param boolean $isInfo True: update all info, False: update only list fanpage * @throws Exception * @return void */ public function storeOrUpdateAllInfoListFanpage($isInfo = false) { try { $this->__fb->setDefaultAccessToken(Session::get('fb_user_access_token', '')); $response = $this->__fb->get(Constants::API_LIST_FANPAGE_LIKES); $feedEdge = $response->getGraphEdge(); $creator = Session::get('id_user_face', null); if ($creator == null) { throw new Exception("Error Processing Request"); } do { $arrId = []; foreach ($feedEdge as $node) { $nodeArr = $node->asArray(); FList::createOrUpdateGraphNode($node); if ($isInfo) { $this->storeOrUpdateInfoFanpage($nodeArr['id']); } $arrId[] = $nodeArr['id']; } foreach ($arrId as $item) { $flist = FList::where('serialno', $item)->first(); if ($flist == null) { continue; } $flist->creator = $creator; $flist->save(); } } while ($feedEdge = $this->__fb->next($feedEdge)); } catch (Exception $e) { throw new Exception("Error Processing Request"); } }
public function listface() { $creator = Session::get('id_user_face', null); if ($creator == null) { $message = "Required log in facebook."; $alertClass = "alert-danger"; return redirect(route('top'))->with(compact('message', 'alertClass')); } $listFanpage = FList::where('creator', $creator)->paginate($this->_itemPerPage); return view('websites.listface', compact('listFanpage')); }