Skip to content

Violating default Laravel first() method behaviour #2311

Open
@vishaltomar76

Description

@vishaltomar76

Description:

when i am using DB::table("users")->where("_id","xyz")->first(); this is returning an array but laravel default behaviour of first() method should return object not an array.
If i am using Model query like User::where("_id","xyz")->first() it's returning object that is perfectly fine but in case of DB queries it returning array not object so here you are violating the default behaviour of first() method

Expected behaviour

first() method should return an object

Actual behaviour

but first() method is returning an array

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