Ejemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  * DELETE /admin\gallery/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $gallery = Gallery::find($id);
         Article::where('gallery_id', '=', $gallery->id)->update(array('gallery_id' => 0));
         Event::where('gallery_id', '=', $gallery->id)->update(array('gallery_id' => 0));
         Page::where('gallery_id', '=', $gallery->id)->update(array('gallery_id' => 0));
         if ($gallery->delete()) {
             return Response::json(['message' => 'A(z) ' . $id . ' azonosítójú galéria törlése sikerült!', 'status' => true]);
         } else {
             return Response::json(['message' => 'A(z) ' . $id . ' azonosítójú galéria törlése nem sikerült!', 'status' => false]);
         }
     } catch (Exception $e) {
         if (Config::get('app.debug')) {
             return Response::json(['message' => $e->getMessage(), 'status' => false]);
         } else {
             return Response::json(['message' => 'A(z) ' . $id . ' azonosítójú galéria törlése nem sikerült!', 'status' => false]);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the resource.
  * GET /site\index
  *
  * @return Response
  */
 public function index()
 {
     View::share('title', 'Főoldal');
     $article = Article::where('shows', '=', true)->orderBy('created_at', 'DESC')->select(['id', 'title', 'author_id', 'created_at', 'content'])->paginate(10);
     $this->layout->content = View::make('index')->with('articles', $article);
 }