/** * * @param type $tagSlug */ public function tag($id) { $tag = Tag::where('id', '=', $id)->first(['id', 'name']); View::share('title', 'Hírek: ' . $tag->name); $article = Article::withAnyTag($tag->name)->orderBy('created_at', 'desc')->paginate(10); $this->layout->content = View::make('site.article.tag')->with('articles', $article)->with('tag', $tag); }
/** * Display a listing of the resource. * * @return Response */ public function index() { View::share('title', 'Vezérlőpult'); $this->layout->content = View::make('admin')->with('article', Article::count())->with('event', Event::count())->with('gallery', Gallery::count())->with('page', Page::count()); }
/** * 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]); } } }
/** * Remove the specified resource from storage. * DELETE /admin\article/{id} * * @param int $id * @return Response */ public function destroy($id) { try { $article = Article::find($id); if ($article->delete()) { return Response::json(['message' => 'A(z) ' . $id . ' azonosítójú hír törlése sikerült!', 'status' => true]); } else { return Response::json(['message' => 'A(z) ' . $id . ' azonosítójú hír 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ú hír törlése nem sikerült!', 'status' => false]); } } }
|-------------------------------------------------------------------------- | Application & Route Filters |-------------------------------------------------------------------------- | | Below you will find the "before" and "after" events for the application | which may be used to do any work before or after a request into your | application. Here you may also register your custom route filters. | */ App::before(function ($request) { Event::fire('clockwork.controller.start'); /** * A láblévben megjelenő cikkek objektumát hozza létre. */ if (!Request::is('admin') && !Request::is('admin/*')) { View::share('articleFooter', \Divide\CMS\Article::orderBy('created_at', 'desc')->take('3')->get(['id', 'title', 'author_id', 'created_at'])); } /** * A felhasználó objektumát hozza létre!. */ if ((Request::is('admin') || Request::is('admin/*')) && Sentry::check()) { View::share('user', \Divide\CMS\User::find(\Sentry::getUser()->id)); } /* if(Request::path()!='/') { return Redirect::to('/'); } */ /* if( ! Request::secure() && FALSE) { return Redirect::secure(Request::path()); } */
/** * 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); }