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


PHP Topic::makeExcerpt方法代码示例

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


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

示例1: update

 public function update(CreateTopicRequest $request, $id)
 {
     $topic = Topic::findOrFail($id);
     $data = $request->only('title', 'body', 'node_id');
     $this->authorOrAdminPermissioinRequire($topic->user_id);
     $markdown = app('markdown');
     $data['body_original'] = $data['body'];
     $data['body'] = $markdown->convertMarkdownToHtml($data['body']);
     $data['excerpt'] = Topic::makeExcerpt($data['body']);
     $topic->update($data);
     Flash::success(lang('Operation succeeded.'));
     return redirect()->route('topics.show', $topic->id);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:13,代码来源:TopicsController.php

示例2: create

 public function create(CreatorListener $observer, $data)
 {
     $data['user_id'] = auth()->id();
     $data['created_at'] = Carbon::now();
     $data['updated_at'] = Carbon::now();
     $data['body_original'] = $data['body'];
     $data['body'] = app('markdown')->convertMarkdownToHtml($data['body']);
     $data['excerpt'] = Topic::makeExcerpt($data['body']);
     $topic = Topic::create($data);
     if (!$topic) {
         return $observer->creatorFailed($topic->getErrors());
     }
     auth()->user()->increment('topic_count', 1);
     //TODO
     //Robot::notify($data['body_original'], 'Topic', $topic, Auth::user());
     return $observer->creatorSucceed($topic);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:17,代码来源:TopicCreator.php

示例3: create

 public function create(CreatorListener $observer, $data)
 {
     $data['user_id'] = Auth::id();
     $data['created_at'] = Carbon::now()->toDateTimeString();
     $data['updated_at'] = Carbon::now()->toDateTimeString();
     $markdown = new Markdown();
     $data['body_original'] = $data['body'];
     $data['body'] = $markdown->convertMarkdownToHtml($data['body']);
     $data['excerpt'] = Topic::makeExcerpt($data['body']);
     // Validation
     $this->form->validate($data);
     $topic = Topic::create($data);
     if (!$topic) {
         return $observer->creatorFailed($topic->getErrors());
     }
     Auth::user()->increment('topic_count', 1);
     Robot::notify($data['body_original'], 'Topic', $topic, Auth::user());
     return $observer->creatorSucceed($topic);
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:19,代码来源:TopicCreator.php

示例4: update

 public function update($id)
 {
     $topic = Topic::findOrFail($id);
     $data = Input::only('title', 'body', 'node_id');
     $this->authorOrAdminPermissioinRequire($topic->user_id);
     $markdown = new Markdown();
     $data['body_original'] = $data['body'];
     $data['body'] = $markdown->convertMarkdownToHtml($data['body']);
     $data['excerpt'] = Topic::makeExcerpt($data['body']);
     // Validation
     app('App\\Http\\Requests\\TopicCreationForm')->validate($data);
     $topic->update($data);
     flash()->success('Good jobs!', lang('Operation succeeded.'));
     return Redirect::route('topics.show', $topic->id);
 }
开发者ID:stevejobsii,项目名称:phphub-laravel5.1,代码行数:15,代码来源:TopicsController.php


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