示例#1
0
 /**
  * Show User Dashboard, generate pagesUrl if there are no pages for User
  * @return View
  */
 protected function userDashboard()
 {
     if (count($this->pages) == 0) {
         $pagesUrl = $this->facebook->generateUserPagesUrl();
         Session::put('pagesUrl', $pagesUrl);
         return view('user.dashboard')->with('user', $this->user);
     }
     return view('user.dashboard')->with('user', $this->user)->with('pages', $this->pages);
 }
示例#2
0
 public function pageData($page_id)
 {
     // Checking if request is legitimate page that exists in DB
     if (!($page = Page::find($page_id))) {
         abort(404);
     }
     // Check if page user is identical to app user
     if ($page->user->id != $this->user->id) {
         abort(500);
     }
     // Get Page data from Facebook API
     $response = $this->facebook->getPageDataFromFacebook($page_id, $page->page_token)->asArray();
     // Update page data in DB
     $this->dbhelper->updatePageData($page, $response);
     return view('user.dashboard')->with('user', $this->user)->with('pages', $this->user->pages)->with('activePage', $page);
 }