public function addFollowAuthor(Request $request) { $result = FollowAuthor::firstOrCreate(array('my_id' => \Auth::user()->id, 'user_id' => $request->get('id'))); if ($result) { $this->setResult("关注成功"); $this->succeed(true); } else { $this->setResult("关注失败"); $this->fail(true); } }