xxxxxxxxxx
// Assuming you have a model called `User` representing the database table
$user = User::updateOrCreate(
['email' => 'example@example.com'], // Criteria to locate the record (e.g., email)
['name' => 'John Doe', 'age' => 25] // Attributes to update or create
);
// The above code will try to find a user with email 'example@example.com'.
// If found, it will update the user's name and age.
// If not found, it will create a new user with the provided email, name, and age.
xxxxxxxxxx
$flight = App\Flight::updateOrCreate(
['departure' => 'Oakland', 'destination' => 'San Diego'],
['price' => 99]
);