1👍
You can use laravel relations, and get the data in single variable.
Then there will be no need to merge two variables.
you can do in your User model like this:
public function user_data() {
return $this->hasMany('App\UserData');
}
where UserData will be your second model with whome you will create relation.
in controller you will write lik this:
$users = User::with('user_datas')->get();
return response()->json(['data'=>$users]);
then in your vue file
<div v-for="user in users">
<h1>{{user.first_name}}</h1>
<ul>
<li v-for="user_data in user.user_datas">{{user_data.title}}</li>
</ul>
</div>
- [Vuejs]-Masked input gets data incorrectly
- [Vuejs]-We also need to provide each component with a "key" vuejs
Source:stackexchange.com