I am new in Laravel, i am trying to send all the values of a form to a database along with some other/modified values by using fill()
in laravel 5.1.
here is how my controller looks like
public function store(Request $request)
{
$pages = new Pages; //i have a model with name Pages
$pages->fill(Input::all());
$pages->save();
return "data saved successfully";
}
Whenever i want to fill data into the table i get these values.
But before sending the data into database i want to mention some other attributes as well like $userid
, change the datetime format to timestamp
and then i want to send the data to database.
I want to use fill(Input::all());
method because if i need to add more field in the form, then i wont have to modify my controller or model.
Any suggestion will be helpful.Or any other best practice will also work. Thank you! (in advance)