the laravel framework has a handy function that is called updateOrCreate().
How can I do something like this in wordpress, whereas
Flight is the model in laravel and could be replaced by
$flight = Flight::updateOrCreate( ['departure' => 'Oakland', 'destination' => 'San Diego'], ['price' => 99, 'discounted' => 1] );
Does something like this also exists for
I appreciate your replies!