Exemplo n.º 1
0
Arquivo: post.php Projeto: svlt/back
 /**
  * POST /post.json
  * Create a new post
  * 
  * @todo Allow posting to a buddy's page
  * @param \Base $fw
  */
 public function post(\Base $fw)
 {
     $userId = self::_requireAuth();
     if ($fw->get('POST.user_id') != $userId) {
         \App::error(403);
     }
     $post = \Model\Post::create(['user_id' => $userId, 'page_id' => $fw->get('POST.user_id'), 'content' => $fw->get('POST.content')]);
     $detail = \App::model('post/detail')->load($post->id);
     $this->_json($detail->cast());
 }