コード例 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param CustomRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(CustomRequest $request, $id)
 {
     $society = Society::findOrFail($id);
     if ($request->hasFile('image') && $request->file('image')->move(base_path() . '/public/images/society', $society->id . '.' . $request->file('image')->getClientOriginalExtension())) {
         $request->merge(['picture' => $society->id . '.' . $request->file('image')->getClientOriginalExtension()]);
     }
     $society->update($request->all());
     return redirect(route('admin.societies.index'))->with('success', 'Le contenu a bien été mis à jour');
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param CustomRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(CustomRequest $request, $id)
 {
     $gallery = Gallery::findOrFail($id);
     if ($request->hasFile('image') && $request->file('image')->move(base_path() . '/public/images/galleries', $gallery->id . '.' . $request->file('image')->getClientOriginalExtension())) {
         $request->merge(['picture' => $gallery->id . '.' . $request->file('image')->getClientOriginalExtension()]);
     } else {
         return redirect(route('admin.galleries.index'))->with('error', 'Une erreur est survene lors de l\'upload de l\'image. Veuillez réessayer');
     }
     $gallery->update($request->all());
     return redirect(route('admin.galleries.index'))->with('success', 'La galerie photo a bien été mise à jour');
 }