Inserting & Updating Models: Mass Assignment

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name'];
}
$flight = App\Flight::create(['name' => 'Flight 10']);
$flight->fill(['name' => 'Flight 22']);

Guarding Attributes

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    protected $guarded = ['price'];
}
/**
 * The attributes that aren't mass assignable.
 *
 * @var array
 */
protected $guarded = [];

Inserting & Updating Models: Mass Assignment — Structure map

Clickable & Draggable!

Inserting & Updating Models: Mass Assignment — Related pages: