简体   繁体   English

将选择框值保存到数据库laravel

[英]Saving select box value to database laravel

I'm doing my first site in laravel 5 (recently updated from 4.2, and still getting used to it), and I have a view with a select box and I can't get the input data. 我正在laravel 5中做我的第一个站点(最近从4.2更新,并且仍然很习惯),并且我有一个带有选择框的视图,但无法获取输入数据。

The view: 风景:

{!!Form::select('estado', array(
'obra' => 'Obra', 
'licitacion' => 'Licitación', 
'oficial' => 'oficial'), null, ['id' =>'estado' class' => 'form-control']) !!}

In the Controller I do 在控制器中

data = Input::all();

But, if I do dd to the data array the field doesn't appear in it (every field is there but the one in the select box) 但是,如果我对数据数组执行dd,则该字段不会出现在其中(每个字段都存在,但选择框中的一个字段)

In my model I have it in the rules as required. 在我的模型中,我根据需要将其包含在规则中。 My question is, what am I doing wrong, that I can't save the value, Thanks in advance 我的问题是,我做错了什么,我无法保存价值,在此先感谢

Maybe this was really basic stuff, but I figured out, all I had to do was type the following commands in the root of the proyect: 也许这确实是基本的东西,但是我发现,我要做的就是在proyect的根目录中键入以下命令:

php artisan view:clear
php artisan clear:cache

And everything it's working now 现在一切正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM