/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $assign_test = assign::with(['user'])->where('id_coach', '=', $id)->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('assign.show', compact('array')); }
/** * 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")); }