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?