There are following ways in which we can create model objects in controller and insert records to database.
First Approach
$object1 = new Model;
$object1->column = $val;
...
...
$object1->save();
Second Approach
$object2 = new Model();
$object2->column = $val;
...
...
$object2->save();
Both of these work without any problem. I have checked and searched on Internet. But, I don't understand that these two way are exactly same or something else.
And another thing is if I just want to save records to a database table which one is correct and best practice ?
Can anyone describe ?
Thanks,