本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}