当前位置: 首页>>代码示例>>PHP>>正文


PHP Annotation::where方法代码示例

本文整理汇总了PHP中Annotation::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::where方法的具体用法?PHP Annotation::where怎么用?PHP Annotation::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Annotation的用法示例。


在下文中一共展示了Annotation::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $doc_id = $this->argument('doc_id');
     $filename = $this->argument('filename');
     $doc = Doc::where('id', $doc_id)->first();
     $this->info("Exporting activity for " . $doc->title);
     $annotations = Annotation::where('doc_id', $this->argument('doc_id'))->with('user')->with('comments')->get();
     $comments = Comment::where('doc_id', $this->argument('doc_id'))->with('user')->get();
     $headers = array("Created At", "Link", "Display Name", "Full Name", "Email", "Type", "Quote", "Text");
     $toExport = array();
     foreach ($annotations as $annotation) {
         $annotationArray = array();
         $annotationArray['date'] = $annotation->created_at;
         $annotationArray['link'] = URL::to('/') . $annotation->uri . '#annotation_' . $annotation->id;
         $annotationArray['display_name'] = $annotation->user->fname . " " . substr($annotation->user->lname, 0, 1);
         $annotationArray['full_name'] = $annotation->user->fname . " " . $annotation->user->lname;
         $annotationArray['email'] = $annotation->user->email;
         $annotationArray['type'] = 'Annotation';
         $annotationArray['quote'] = $annotation->quote;
         $annotationArray['text'] = $annotation->text;
         array_push($toExport, $annotationArray);
         foreach ($annotation->comments as $comment) {
             $user = User::find($comment->user_id);
             $commentArray = array();
             $commentArray['date'] = $comment->created_at;
             $commentArray['link'] = "";
             $commentArray['display_name'] = $user->fname . " " . substr($user->lname, 0, 1);
             $commentArray['full_name'] = $user->fname . " " . $user->lname;
             $commentArray['email'] = $user->email;
             $commentArray['type'] = "Annotation Comment";
             $commentArray['quote'] = "";
             $commentArray['text'] = $comment->text;
             array_push($toExport, $commentArray);
         }
     }
     foreach ($comments as $comment) {
         $commentArray = array();
         $commentArray['date'] = $comment->created_at;
         $commentArray['link'] = "";
         $commentArray['display_name'] = $comment->user->fname . " " . substr($comment->user->lname, 0, 1);
         $commentArray['full_name'] = $comment->user->fname . " " . $comment->user->lname;
         $commentArray['email'] = $comment->user->email;
         $commentArray['type'] = $comment->parent_id === null ? "Comment" : "Sub-comment";
         $commentArray['quote'] = "";
         $commentArray['text'] = $comment->text;
         array_push($toExport, $commentArray);
     }
     $this->info('Saving export to ' . $filename);
     $fp = fopen($filename, 'w');
     fputcsv($fp, $headers);
     foreach ($toExport as $row) {
         fputcsv($fp, $row);
     }
     fclose($fp);
     $this->info('Done.');
 }
开发者ID:iaincollins,项目名称:madison,代码行数:61,代码来源:ActivityExport.php

示例2: postComments

 public function postComments($docId, $annotationId)
 {
     $comment = Input::get('comment');
     $annotation = Annotation::where('doc_id', '=', $docId)->where('id', '=', $annotationId)->first();
     $annotation->link = $annotation->getLink();
     $annotation->type = 'annotation';
     $result = $annotation->addOrUpdateComment($comment);
     // TODO: Hack to allow notification events.  Needs cleaned up.
     $result->doc_id = $docId;
     $result->link = $result->getLink($docId);
     Event::fire(MadisonEvent::DOC_SUBCOMMENT, array('subcomment' => $result, 'parent' => $annotation));
     return Response::json($result);
 }
开发者ID:sethetter,项目名称:madison,代码行数:13,代码来源:AnnotationApiController.php


注:本文中的Annotation::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。