Skip to content

Commit

Permalink
Note upgrade for find method
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed May 20, 2015
1 parent 7680b29 commit bb409dd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Secondly, the `App\Services\Registrar` class used in Laravel 5.0 is no longer ne

### Eloquent

#### Create Method Signature
#### The `create` Method

Eloquent's `create` method can now be called without any parameters. If you are overriding the `create` method in your own models, set the default value of the `$attributes` parameter to an array:

Expand All @@ -45,6 +45,21 @@ Eloquent's `create` method can now be called without any parameters. If you are
// Your custom implementation
}

#### The `find` Method

The `find` method has now been removed from the `Model` class. Calling `User::find()` will instead defer the call to the underlying Eloquent Query Builder, as all other querying methods do.

If you have been overriding the `find` method in your own models and calling `parent::find()`, you should now change it to call `find` on the query directly:

public static function find($id, $columns = ['*'])
{
$model = static::query()->find($id, $columns);

// do something with the model

return $model;
}

#### Date Formatting

Previously, the storage format for Eloquent date fields could be modified by overriding the `getDateFormat` method on your model. This is still possible; however, for convenience you may simply specify a `$dateFormat` property on the model instead of overriding the method.
Expand Down

0 comments on commit bb409dd

Please sign in to comment.