I have a form attributes called, name, description and features where features is a multiple checkboxes which is like
feature 1
feature 2
feature 2
feature 4
User can select multiple checkbox at once. I have a database table called product like
-----------------------------------------
id name description features
-----------------------------------------
When user selects the multiple checkbox, i need to insert all checkbox value in the features column. Right now I can echo the selected checkbox value like
$feat = Input::get('features');
foreach ($feat as $key => $n){
echo $feat[$n];
}
but I need those features to insert into the database, for normal insertion, we would do like:
$product = new Product;
$product->name = Input::get('name');
$product->description = Input::get('description');
$product->features = Input::get('features');
$product->save();
but how should i modify the above code in order to save the array value to the database? I am trying to insert the value to same column because i won't be querying it on the basis of features.