Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function storeTopic($id, CreateTopicRequest $request)
 {
     if ($request->input('topic_important') == 0) {
         $imp = 0;
     } else {
         $imp = 1;
     }
     \Auth::user()->topic()->create(['title' => $request->input('topic_title'), 'body' => $request->input('topic_body'), 'forum_section_id' => $id, 'important' => $imp]);
     flash()->success('Udało Ci się utworzyć nowy temat!');
     return redirect('/forum/' . $request->input('head') . '/' . $request->input('sec') . '');
 }