duanliu6083
2016-07-25 07:07在laravel中将后期数据保存到数据库
I Wanna save post data in Laravel. This is my code:
public function addContact(Request $request){
$contact = new Contact();
$contact->addContact($request);
return back();
}
and in the Model:
public function addContact($contactData){
return $this->save($contactData);
}
it's saves in the database but the data in it is NOT save. saves like an empty row. if I change it to this, it's working:
public function addContact($contactData){
$this->user_id = $contactData->user_id;
$this->text = $contactData->text;
return $this->save();
}
Why the first one is not working?
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- 在laravel中将后期数据保存到数据库
- php
- 2个回答