當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。