Skip to content

Return everything as object and not array #65

Closed
@jgrossi

Description

@jgrossi

Hi!

First thank you for the amazing work!

When getting a post, for example, I get the entire object, like:

$post = Post::find('52827b589a1ef3c65c0041a7');
echo $post->title;

But when I have comments "inside" posts - not using hasMany - I got the comments as array and not object:

$comments = $post->comments;
foreach ($comments as $comment) {
    echo $comment['author']; // will be better $comment->author
}

Does the library have some "config" to ensure returning "object" as default?

Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions