/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, CreateCoachRequest $request, Coach $coach) { $player_to_update = $coach->find($id); $uploaded_image = $request->file('image_upload'); $parameter = $request->all(); if (isset($uploaded_image)) { $ext = $uploaded_image->getClientOriginalExtension(); $newImageName = $player_to_update->id . "." . $ext; $uploaded_image->move(base_path() . '/public/img/uploads/coach/', $newImageName); Image::make(base_path() . '/public/img/uploads/coach/' . $newImageName, array('width' => 774, 'height' => 329))->save(base_path() . '/public/img/uploads/coach/' . $newImageName); $parameter = $request->all(); $parameter['image'] = $newImageName; /* remove this field from the parameters list */ unset($parameter['image_upload']); $player_to_update->update($parameter); } else { $player_to_update->update($request->all()); $player_to_update->update($parameter); } return redirect('coach'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id, CoachDetail $clubhistories, Club $club, ChampionshipDetail $championship, Coach $coach) { return view('admin.coachdetail.edit')->with('coachdetail', $clubhistories->find($id))->with('club', $club->lists('name', 'id'))->with('coach', $coach->lists('name', 'id')); }