public function actionShare($id)
 {
     $this->useSession();
     $post = Post::whereProviderId($id)->first();
     $request = new FacebookRequest($this->session, 'POST', '/me/feed', ['link' => $post->link]);
     $response = $request->execute();
     $graphObject = $response->getGraphObject();
     return $graphObject->getProperty('success');
 }
 public function post($id)
 {
     $post = Post::whereProviderId($id)->first();
     if ($post) {
         return $post;
     }
     $source = (array) $this->getPost($id);
     $postData = array();
     foreach ($this->fieldMap as $key => $value) {
         $t = null;
         if ($value) {
             // closure
             if (is_object($value) && $value instanceof Closure) {
                 $t = $value($source);
             } else {
                 if (is_string($value) && isset($source[$value])) {
                     $t = $source[$value];
                 } else {
                     if (is_array($value)) {
                         foreach ($value as $v) {
                             if (isset($source[$v]) && strlen($source[$v])) {
                                 $t = $source[$v];
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         $postData[$key] = $t;
     }
     if ($postData['posted_at'] && (string) (int) $postData['posted_at'] != $postData['posted_at']) {
         $postData['posted_at'] = strtotime($postData['posted_at']);
     }
     $postData['provider'] = $this->provides;
     $postData['provider_id'] = $id;
     $postData['user_id'] = $this->user->id;
     $postData['meta'] = json_encode($source);
     $post = new Post($postData);
     $post->save();
     return $post;
 }