Reputation: 751
I have the following code
$input = Input::all();
return $input;
It returns all the data I entered in the form. Since all the data is available, I tried to insert data into database as
$this->agro->create($input);
When I check the database,the empty string is inserted. I am confused,why the data is not inserted when the $input is displaying the inserted data in the form. Please HELP!!!
EDIT
This is User Model
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
public $timestamps = false;
protected $fillable = ['title','content','author'];
protected $table = 'tbl_article';
}
And this is my form
{{@Form::open(['route'=>'agrovet.store'])}}
<div>
{{ @Form::label('lbl_title','Title') }}
{{ @Form::text('title') }}
</div>
<div>
{{ @Form::label('lbl_content','Content') }}
{{ @Form::text('content') }}
</div>
<div>
{{ @Form::label('lbl_author','Author') }}
{{ @Form::text('author') }}
</div>
<div>
{{ @form::submit('submit')}}
</div>
Upvotes: 2
Views: 234
Reputation: 152880
The names of your text inputs are wrong. You should use the same name as your model attributes (and labels)
{{ @Form::label('title','Title') }}
{{ @Form::text('title') }}
and the same for the others...
Upvotes: 1