标签: php laravel laravel-5 laravel-5.3
我想返回我需要的唯一字段,但是当集合有关系时,它将无效。
例如:
$items = $items->map(function($item) { return collect($item)->only([ 'id', 'posts.title', 'name', 'created_at' ]); });
只有未返回的内容是'posts.title'
'posts.title'
如何解决这个问题?