updateOrCreate - Match created_at (just the date part)

Posted 3 years ago by tedmasterweb

Does anyone know how to use updateOrCreate where one of the keys is created_at and the value to match is just the date part of the field? For example:

Unit::updateOrCreate(
    [
        'created_at' => '2016-05-11'
    ],
    [
        'name' => 'hello'
    ]
)

This isn't working for me because created_at is a datetime and apparently the equivalency is '=' when using updateOrCreate.

TIA

Please sign in or create an account to participate in this conversation.