public function getById($id) { $user = User::where('id', '=', Auth::user()->id)->first(); $relations = Relation::where([['user_id', '=', $user->id], ['thread_id', '=', $id]])->first(); return Response::json(Thread::find($relations->thread_id)); }