在 Laravel 中与 ->profiles() 和 ->profiles 的关系有什么区别?

What is difference between relation with ->profiles() and ->profiles in Laravel?

with->profiles() 和 Laravel 中的 ->profiles 有什么区别?

示例:

$posts = $user->posts; // model -> collection
$posts = $user->posts()->get(); // model -> relation -> collection

在此处阅读更多内容:https://laracasts.com/discuss/channels/eloquent/dynamic-property-vs-method-in-eloquent-orm

->profiles returns 相关模型的集合

->profiles() returns关系的实例,如果你想更新相关模型,这很方便