1/**
2 * The attributes that aren't mass assignable.
3 *
4 * @var array
5 */
6protected $guarded = [];
1// If there's a flight from Oakland to San Diego, set the price to $99.
2// If no matching model exists, create one.
3$flight = App\Models\Flight::updateOrCreate(
4 ['departure' => 'Oakland', 'destination' => 'San Diego'],
5 ['price' => 99, 'discounted' => 1]
6);
1$flight = App\Models\Flight::find(1);
2
3$flight->name = 'New Flight Name';
4
5$flight->save();