/** * Show the form for creating a new resource. * * @return Response */ public function create($id) { $id_fiche = $id; $id_user = Auth::user()->id; $assign_test = assign::with(['user'])->where('id_coach', '=', $id_user)->get(); $array = []; $i = 0; foreach ($assign_test as $key => $value) { foreach ($value["attributes"] as $key1 => $value1) { if ($key1 === 'id_client') { $user = User::where('id', '=', $value1)->first(); $array[$i] = $user; } } $i++; } return view('fich_act.create', compact("id_fiche", "id_user", "array")); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $users = User::paginate(15); $assigns = assign::get(); return view('user.index', compact('users', 'assigns')); }
public function assignclient($id) { $selected_coach = User::where('id', '=', $id)->get(); dd($selected_coach); $users = User::where('role', '=', 3)->get(); $assigns = assign::get(); foreach ($users as $user) { foreach ($assigns as $assign) { dd($assign); } } return view('assign.client', compact('users', 'selected_coach')); }