how can i use a name for html input that is differ from the column name that i want to save this input data to
i usually use this method since all html inputs names are equal to DB columns :
Model::create($request->all());
Now i know i can use this:
Model::create([
'name' => $request->name,
'feild' = > $request=>value,
etc.
]);
but i have a lot of values and i don't want to rewrite it over and over , so is there a way that combine the $request->all() with the second method ?
source https://stackoverflow.com/questions/72665840/using-different-name-of-html-input-than-the-db-column-name-in-laravel
No comments:
Post a Comment