How to save multiple addresses field for a single user in eloquent
I wanna save and retrieve multiple addresses for a user, also have created multiple address field using JQuery
public function store(Request $request)
{
$user = new User();
$data = $this->validate($request, [
//User detail
'name' => 'required',
'gender' => 'required',
'phone' => 'required',
//Address fields
'city' => 'required',
'state' => 'required',
'country' => 'required'
]);
}
I can get input for request from blade as below
{“name”:”name”,”gender”:”Male”,”phone”:”999999999″,”city”:”city1″,”state”:”state1″,”country”:”India”,”city”:”city2″,”state”:”state2″,”country”:”India”}
Now here I wanna save this —-> city1, state1, india and city2, state2, india into different column in single table.
from Laravel Questions and Answers https://laravelquestions.com/laravel/how-to-save-multiple-addresses-field-for-a-single-user-in-eloquent/
via Lzo Media
No comments:
Post a Comment