I have encountered something strange which I consider might be a bug in the framework itself so I'm wondering if there were similar experiences with it.
I have two entities: Contact and Media in a 1:M relationship. Relationship is defined as:
public function media()
{
return $this->hasMany(Media::class);
}
Now the issue I see is that when I go on show controller method and load the relation like this:
public function show(Contact $contact)
{
$contact->load('media');
return response()->json($contact);
}
The contact is resolved fine, with media relationship in the following way:
"first_name": "Melisa",
...
"media": [
{
"id": 50,
...
However if I modify the case of the relationship so that I call:
public function show(Contact $contact)
{
$contact->load('mEdIa');
return response()->json($contact);
}
It returns:
"first_name": "Melisa",
...
"m_ed_ia": [
{
"id": 50,
...
...which is really disturbing. Is it supposed to happen?