Laravel correlation table flattened output

problem description

does Laravel have its own internal method to flatten the output of the associated table and the original table:
[

]
"a" => "1",
"b" => "2",
"c" => [
    "d" => 3,
    "e" => 4,
] 

]

[

]
"a" => "1",
"b" => "2",
"d" => 3,
"e" => 4,

]
remove the associated table c and read out the fields directly

Thank you

Nov.09,2021

you can use the converter


array_flatten () to flatten the output, but return an indexed array.

Menu