updateOrCreate is creating new row instead of updating old one

Posted 4 months ago by ssquare
$map_data = Map_data::updateOrCreate(
                                    [ 'map_data' => json_encode($request->row), 'up_to_date' => 1],
                                    [ 'table_name' => 'table1' ]);

Already existed row have table_name => table1, map_data => json_encoded_array, up_to_date => 0

I just want to check either table_name is already existed or not. It should not check either up_to_date is either 0 or 1. No matter what is its previous results, it should be updated to 1.

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