In previous versions of Laravel 5.x (I'm not sure when it was changed) I was able to call static method create
on any Eloquent Model class to insert records into a database.
For example:
EloquentUser::create([
'name' => self::ADMIN_NAME,
'email' => self::ADMIN_EMAIL,
'password' => bcrypt(self::ADMIN_PASSWORD),
]);
That was calling public static function create
in Model.php (vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php
).
public static function create(array $attributes = [])
{
$model = new static($attributes);
$model->save();
return $model;
}
In Laravel 5.5 I'm still able to call create
however Model.php is totally rearranged and does not contain this method. What's more important, searching within whole vendor / Illuminate gives me nothing like that. Please explain, how it still works, what it calls behind the scenes.
Thanks.