public function action_index($username) { $user = User::where_username($username)->first(); $user_messages = null; if (!is_null($user)) { $user_messages = Forummessage::with('topic')->where_user_id($user->id)->order_by('created_at', 'DESC')->take(5)->get(); } return View::make('panel::profile.show', compact('user', 'user_messages')); }
public function action_reply($topic_slug, $topic_id) { $topic = Forumtopic::find($topic_id); if (is_null($topic)) { return Event::first('404'); } $category = $topic->category; $messages = $topic->messages()->order_by('created_at', 'DESC')->take(5)->get(); $originalMess = Forummessage::with('user')->where_id(Input::get('o'))->first(array('user_id', 'content_bbcode')); $bbcodeCite = null; if ($originalMess) { $bbcodeCite = "[quote=" . $originalMess->user->username . "]" . $originalMess->content_bbcode . "[/quote]"; } return View::make('forums::topic.reply', array('category' => $category, 'topic' => $topic, 'messages' => $messages, 'cite' => $bbcodeCite)); }