在 with 查询中只查询个别字段
$data = Answer::with(['questionInfo' => function ($query) { $query->select('id', 'title'); }])->where("user_id",8) ->orderBy("created_at", 'desc') ->select(["id", "question_id", "content", "created_at"]);
width里面一定要加id
$data = Answer::with(['questionInfo' => function ($query) { $query->select('id', 'title'); }])->where("user_id",8) ->orderBy("created_at", 'desc') ->select(["id", "question_id", "content", "created_at"]);
width里面一定要加id