预先加载时,关系后跟两个列名的冒号有什么作用?

What does a colon followed by two column names after a relationship do when eager loading?

在为我处理 Datatables 的问题寻找修复时,我发现了这个有趣的语法,但我在 Laravel 文档中找不到任何可以帮助我的东西了解发生了什么,但我想了解它的可用性。

这是代码片段:

return $model->select('sessions.*')
        ->with('employee:id,name');

文档中提到:https://laravel.com/docs/8.x/eloquent-relationships#eager-loading-specific-columns

You may not always need every column from the relationships you are retrieving. For this reason, Eloquent allows you to specify which columns of the relationship you would like to retrieve:

$books = Book::with('author:id,name')->get();