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
The method withDefault does not seem to be called on morphTo relationships.
Steps To Reproduce:
I have a table Mission which relates to other tables to store mission specific data, depending on the mission template. For example, when mission template is 'create-company', we use a CreateCompanyData model.
The Mission model has a mission_data() relationship described as:
public function mission_data() : MorphTo {
return $this->morphTo('mission_data')
->withDefault(function() {
if ($this->template==='') {
return new CreateCompanyData();
}
// Handle other template values + throw when template unknown
// ...
});
}
When debugging my unit tests, it appears that breakpoints never get hit when placed inside the withDefault callback, even when no relation has been provided yet (function simply returns null, as if there was no withDefault call defined.
The text was updated successfully, but these errors were encountered:
Description:
The method
withDefault
does not seem to be called onmorphTo
relationships.Steps To Reproduce:
I have a table
Mission
which relates to other tables to store mission specific data, depending on the mission template. For example, when mission template is'create-company'
, we use aCreateCompanyData
model.The
Mission
model has amission_data()
relationship described as:When debugging my unit tests, it appears that breakpoints never get hit when placed inside the withDefault callback, even when no relation has been provided yet (function simply returns null, as if there was no
withDefault
call defined.The text was updated successfully, but these errors were encountered: