I think the docs do a great job explaining this: inserts with 'save' and mass assignment with 'create'. After you understand those, see other creation methods.
save() versus create()
I'm sorry I'm new to Laravel and OOP, so these questions may sound rudimentary. I'm confused about save() or create() methods.
Does save() only works on objects and create() only works on arrays? How can I update a table using a method similar to create() method? (I tried using the create() method for updating a table and it is trying to insert into the table rather than updating a table.) If I have an array and want to update a table (using array), how do I do that? It looks like save() method only works on objects.
Eloquent only deals with objects (models) and performs database inserts and updates to persist those models.
Model::create(array);
is shorthand for the equivalent of
$model = new Model;
$model->fill(array);
$model->save();
new up an empty model(object) then fill it with your array of data, and finally save it.
If you want to update instead then first you have to find the record you are interested in, then update its values, and finally save save it;
$model = Model::findOrFail(1);
$model->fill(array)
$model->save();
Which, like the create method, there is a shortcut for;
Model::findOrFail(1)->update(array);
Please or to participate in this conversation.