Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Collection value() method does not return valid falsey values like '0' or 0 or false. #55722

Copy link
Copy link
Closed
@sajjadhossainshohag

Description

@sajjadhossainshohag
Issue body actions

Laravel Version

12.13.0

PHP Version

8.3.13

Database Driver & Version

No response

Description

The Collection value() method fails to return falsey values such as '0', 0, or false, even when a matching item exists in the collection.

Steps To Reproduce

Route::get('test', function () {
    dd(collect([
        [
            'name' => 'currency',
            'value' => '0' // Also, false, '0'
        ],
        [
            'name' => 'currency_symbol',
            'value' => 'USD'
        ],
    ])->where('name', 'currency')->value('value'));
});


// Expected: '0'
// Actual: null

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.