Esempio n. 1
0
 public function savePages()
 {
     $pagesCollection = array();
     $pages = $this->facebook->userPagesArray();
     if (count($pages) == 0) {
         return redirect('dashboard')->with('no_data', 'You have no band pages with admin privileges, sorry.');
     }
     foreach ($pages as $page) {
         $pagesCollection[] = new Page(['facebook_id' => $page->getField('id'), 'name' => $page->getField('name'), 'page_token' => $page->getField('access_token')]);
     }
     $result = $this->user->pages()->saveMany($pagesCollection);
     return redirect('dashboard');
 }