laravel/framework — pull request #2846 by vlakarados (2013-12-03 12:05:31+00:00)
Title: Make model relationship creates filtered by fillable array

Currently, when creating instances in a model relationship, attribute `$fillable = array(...)` of the relationship is ignored. As stated by the comment, it's done so to allow foreign keys to be automatically set. Now it allows us to do this as it fills attributes beforehand with `fill()` and then sets merged raw attributes filtered by `fill()` with foreign keys, thus, we may now do things like

$contactData = [
'type' => 'qwe',
'value' => 'qwe',
'foo' => 999
];
$client = Client::find(1);
$client->contacts()->create($contactData);

which is much more clean than

$contactData = [
'type' => 'qwe',
'value' => 'qwe',
'foo' => 999
];

$client = Client::find(1);
$clientContact = ClientContact::create($contactData);
$client->contacts()->save($clientContact);

In the examples above `'foo'` database table column does not exist and because of that we get the SQL error if we don't `fill()`.