laravel/framework — pull request #2222 by Jacoby6000 (2013-09-03 21:08:03+00:00)
Title: Made mass assignment functions more efficient.

Currently, a mass assignment call will loop over every single entry in the array passed in to the function.

The changes I made check if fillable has been set for the given model, and if it has, only looks over keys that are in the fillable array. This can have drastic performance gains whenever somebody may have previously passed in a flat array, but only taken a couple of items from that array. Take this example

```php
class Person extends Eloquent{
$table = 'people';
$fillable = ['first_name','last_name','age','height','weight'];
}
class Car extends Eloquent{
$table = 'cars';
$fillable = ['year','model','miles'];
}
class CreateStuff{
public function makeStuff(){
$input = [
'first_name' => 'John',
'last_name' => 'Doe',
'age' => 40,
'height' => '5\'11"',
'weight' => '180lbs',
'year' =>1981,
'model' => 'DeLorean DMC-12',
'miles' => -30000
];
\Person::create($input);
\Car::create($input);
}
}
```

As the fill function is now, the entire array will be iterated over twice; once for each object. With the new implementation, only the data needed (provided in fillable) will be read, meaning each thing will only be read once.