/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Requests\Post\CreateRequest $request) { $input = $request->all(); $input['user_id'] = \Auth::user()->id; $input['popname'] = \Auth::user()->popname; $input['time'] = time(); $post = \Nexus\Post::create($input); \Auth::user()->incrementTotalPosts(); // scan post for mentions \Nexus\Helpers\MentionHelper::makeMentions($post); // if we are viewing the topic with the most recent post at the bottom then // redirect to that point in the page if (\Auth::user()->viewLatestPostFirst) { $redirect = action('Nexus\\TopicController@show', ['id' => $post->topic_id]); } else { $redirect = action('Nexus\\TopicController@show', ['id' => $post->topic_id]) . '#' . $post->id; } return redirect($redirect); }
/** * * @dataProvider providerHighlightMentionsHighlights **/ public function testHighlightMentionsHighlights($input, $expectedOutput) { $output = MentionHelper::highlightMentions($input); $this->assertEquals($expectedOutput, $output); }