I'd like to show names on my select dropdown
I have 3 tables: 'users','users_pro' and 'practice'
users : id ,name ,dob ,.. etc
users_pro : id ,user_id,..etc
practice : id , user_pro_id ,...etc
I want to input data to table 'practice' and I want to make a select dropdown using pluck on users_pro with users like this :
public function input_practice()
{
$data= Users_pro::with('users')->get()->pluck('id','user_id');
dd($data);
// return view('admin.input.input_riwayat_kgb',
// [
// 'data'=>$data,
// ]);
}
If I dd($data), I get :
Collection {#327 ▼
#items: array:4 [▼
6 => 3 // 6 is user_id ,and 3 is 'id' on users_pro , i need to show 'name' like 3 => 'jhon'
13 => 4
12 => 5
14 => 6
]
}
But I want to show the name of the user on my select dropdown. Can someone help me?