Open Siebov opened 4 years ago
In the same time, it works if I use ->with('user') without any additional statements.
If I use "hide" projection
$someModel
->with(['user' => function ($q) {
$q->project([
'email' => 0
])
}])
and there is getter for name - it works quite as expected.
Description:
Getter mutator attribute does not works with -
>project()
statement in query.Steps to reproduce
1.Define
getNameAttribute($value) { return 'Test name'; }
getter function in User (or any other). 2.Create a query usingExpected behaviour
The value of
user.name
in the results should the value of the name after getter, because it's model based Moloquent query and not a raw one.Actual behaviour
The value of user.name is a raw value from DB, without any getter mutation.