/**
  * Store a newly created resource in storage.
  *
  * @param CustomRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(CustomRequest $request)
 {
     if (!$request->hasFile('image')) {
         return redirect(route('admin.galleries.create'))->with('error', 'Veuillez choisir une image');
     }
     $id = Gallery::max('id');
     if ($request->hasFile('image') && $request->file('image')->move(base_path() . '/public/images/galleries', $id . '.' . $request->file('image')->getClientOriginalExtension())) {
         $request->merge(['picture' => $id . '.' . $request->file('image')->getClientOriginalExtension()]);
         $gallery = Gallery::create($request->all());
         mkdir(base_path() . '/public/images/galleries/' . $gallery->id);
         return redirect(route('admin.galleries.index'))->with('success', 'La galerie photo a bien été ajoutée');
     }
     return redirect(route('admin.galleries.index'))->with('error', 'Une erreur est survene lors de l\'upload de l\'image. Veuillez réessayer');
 }