5 years ago

Eloquent Create Method - Always inserts blank entries.

Posted 5 years ago by industriousagency

Has anyone experienced an issue where Laravel refuses to insert data when using the Model::create() method?

I know it's nothing to do with the fields not being mass-assignable (, because I've got the $fillable property set correctly on the model. I can also use the fill method (and save) to insert data on that model, it's just the create method that doesn't seem to insert anything..

To verify it's not to do with being mass assignable, I've also done:


Which still doesn't work..

In Eloquent/Model.php:

public static function create(array $attributes)
 $model = new static($attributes);


 return $model;

If I output the first argument, the attributes are there, it just seems to be when the new class is instantiated it doesn't fill the properties for some reason..

This is actually on L5, but I have had the same on L4 as well.

Thanks in advance!

Please sign in or create an account to participate in this conversation.