You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, fresh and with both accept array or string, fresh basically creates a new object using with, passing along the $with parameter.
But this returns radically different results:
$model1 = new SomeModel::with('relation', 'otherRelation')->find(1);
$model2 = $model1::fresh('relation', 'otherRelation');
This is because fresh will not use func_get_args, but only pass the first parameter on to with(), so otherRelation is just dropped. To make them return the same result, you have to use an array when calling fresh():
Right now,
fresh
andwith
both accept array or string,fresh
basically creates a new object usingwith
, passing along the$with
parameter.But this returns radically different results:
This is because
fresh
will not usefunc_get_args
, but only pass the first parameter on towith()
, sootherRelation
is just dropped. To make them return the same result, you have to use an array when callingfresh()
:I think it would be helpful if the
$with
parameter was used in the same way in both methods.The text was updated successfully, but these errors were encountered: