Interview GURU

How can we create a record in Laravel using eloquent?

We need to create a new model instance if we want to create a new record in the database using Laravel eloquent. Then we are required to set attributes on the model and call the save() method.

Example

public functionsaveProduct(Request $request )  
$product = new product;  
$product->name = $request->name;  
$product->description = $request->name;  
$product->save();