/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $idAlbum = $this->route->getParameter('album'); $album = ImgAlbum::find($idAlbum); if ($album->onlymembers) { if ($this->auth->guest()) { return redirect()->guest('auth/login'); } else { $user = $this->auth->user(); if (!$user->HasAccessAlbum($idAlbum)) { //AGREGAR MENSAJE no ir // return redirect()->to('albumregister/' . $idAlbum); Session::flash('message', 'No tienes acceso.'); return redirect()->back(); } } } return $next($request); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $image = Img::find($id); $albums = ImgAlbum::lists('desc', 'id'); return view('admin.album.images.edit', ['image' => $image, 'albums' => $albums]); }
public function listImg($id) { $Album = ImgAlbum::find($id); return view('pics.listImg')->with('Album', $Album); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $album = ImgAlbum::findOrFail($id); $album->delete(); Session::flash('message', 'Album fue eliminado correctamente'); return Redirect::to('/administration/album'); }