Other Creation Methods: UpdateOrCreate

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99]
);

You may also come across situations where you want to update an existing model or create a new model if none exists.

Other Creation Methods: UpdateOrCreate — Structure map

Clickable & Draggable!

Other Creation Methods: UpdateOrCreate — Related pages: