如何批量分配laravel可填写

时间:2016-11-20 14:32:00

标签: php laravel

<form action="display" method="post">

<label>Details</label></br> 
<input type="radio" name="vishal" value="male">vishal</br>  
<input type="radio" name="vishal" value="female">male</br>  
<input type="radio" name="vishal" value="other">other</br>  

<input type="hidden" name="_token" value="xYj3n27EQNybQvY29mDrZxoYy3sGtbFTqfN8xeso">    

<label>Details</label></br> 
<input type="radio" name="rahul" value="male">rahul</br>    
<input type="radio" name="rahul" value="female">male</br>   
<input type="radio" name="rahul" value="other">other</br>   

<input type="hidden" name="_token" value="xYj3n27EQNybQvY29mDrZxoYy3sGtbFTqfN8xeso">    

<label>Details</label></br> 
<input type="radio" name="demo" value="male">demo</br>  
<input type="radio" name="demo" value="female">male</br>    
<input type="radio" name="demo" value="other">other</br>    

<input type="hidden" name="_token" value="xYj3n27EQNybQvY29mDrZxoYy3sGtbFTqfN8xeso">

<input type="submit" name="submit" value="submit">
</form>
  • 如何在不手动填写每个字段的情况下插入?
  • 我目前有以下受保护的$ fillable = ['性别','vishal','rahul','演示'];
  • 但我的字段是多个,我无法为每个字段编写手动可填写参数
  • 如何在没有 $ fillable的情况下插入数据库?

1 个答案:

答案 0 :(得分:2)

发现解决方案需要使用

YourModel:: forceCreate($request->all());