We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be nice if you would create a wrapper for toArray(), making the following output:
toArray()
/* Entry belongsTo Channel, Entry hasMany Files */ $result = Entries::with('Channel', 'Files'); print_r($result->toArray());
[ 0 => [ 'id' => 1, 'channel_id' => 1, 'Channel' => [ 'id' => 1, 'name' => 'My Chanel' ], 'Files' => [ 0 => [ 'id' => 1, 'entry_id' => 1, 'name' => 'foo.jpg' ] ] ] ]
What I do currently:
$data = []; $i = 0; foreach ($result as $row) { $data[$i] = $row->toArray(); $data[$i]['Channel'] = $row->channel->toArray(); foreach ($row->files as $file) { $data[$i]['Files'][] = $file->toArray(); } $i++; }
The text was updated successfully, but these errors were encountered:
Same issue.
Sorry, something went wrong.
No branches or pull requests
Would be nice if you would create a wrapper for
toArray()
, making the following output:What I do currently:
The text was updated successfully, but these errors were encountered: