array_build => array_map

This commit is contained in:
Daniel Klabbers 2017-11-01 17:20:12 +01:00
parent 3eede757bb
commit d7306dedb7

View File

@ -484,9 +484,9 @@ class User extends AbstractModel
*/
public function getPreferencesAttribute($value)
{
$defaults = array_build(static::$preferences, function ($key, $value) {
return [$key, $value['default']];
});
$defaults = array_map(function ($value) {
return $value['default'];
}, static::$preferences);
$user = array_only((array) json_decode($value, true), array_keys(static::$preferences));