-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Labels
Description
Hi,
Like #9427, I'm running into some strange naming behaviour with polymorphic relations. I would like to ask you to look at this again.
My polymorphic relation is defined as follows in class Module:
public function moduleInstance()
{
return $this->morphTo();
}
Now, in order to load this relation, I have to call:
$module->load('moduleInstance');
However, to retrieve this relation, I have to call:
$module->module_instance
This clearly shows that naming is inconsistent. All relations are named using camel case and it seems that only polymorphic relations are named using snake case.
Here is another example that clearly shows this inconsistent behaviour:
// moduleType is another, BelongsTo relation that is named using camel case
$module->load(['moduleInstance', 'moduleType']);
dd($module);
Below is a screenshot that shows the result of executing the above code:
Also note that another empty relation ('moduleInstance') is added using an actually consistent name.
Thanks in advance!
