/** * Let current user follow user $target_id * * @return Response */ public function store() { $target_id = Input::get('target'); $user_id = Auth::id(); $params = array('user_id' => Auth::id(), 'target_id' => $target_id); $follow = Follow::withTrashed($params)->where($params)->first(); if ($follow === null) { $follow = new Follow($params); $follow->save(); FeedManager::followUser($follow->user_id, $follow->target_id); } elseif ($follow->trashed()) { $follow->restore(); FeedManager::followUser($follow->user_id, $follow->target_id); } return Redirect::to(Input::get('next')); }