最简单的方法是将所需字段添加到
get()方法中,并为要重命名的字段添加别名。
Products::where("actice", "=", true) ->joinWithTags ->get(['tags.name AS tag_name', 'products.*']) ->toArray();
最简单的方法是将所需字段添加到
get()方法中,并为要重命名的字段添加别名。
Products::where("actice", "=", true) ->joinWithTags ->get(['tags.name AS tag_name', 'products.*']) ->toArray();