为什么函数 getQuery()与模型中的 query()不同?
app($classModel)->getQuery() != app($classModel)->query() or app($classModel)->getQuery() != $classModel::query()
在此示例中,model1与model2不同,为什么?
$model1 = app($class)->query()->first();
=> App\Models\User {#3389
id: 1,
name: "laisha88",
first_name: "Jackson",
last_name: "McKenzie"
}
$model2 = app($class)->getQuery()->first();
=> {#3369
+"id": 1,
+"name": "laisha88",
+"first_name": "Jackson",
+"last_name": "McKenzie"
}