/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Content_category::create(['type' => 'page', 'title' => 'nezařazeno', 'description' => 'Stránky bez kategorie.']);
     Content_category::create(['type' => 'page', 'title' => 'Soustředění', 'description' => 'Pořádaná soustředění klubu ABM.']);
     Content_category::create(['type' => 'page', 'title' => 'Tábor', 'description' => 'Připravované/pořádané tábory.']);
     Content_category::create(['type' => 'page', 'title' => 'Oddilovy přebor', 'description' => 'Pořádaná soustředení klubu ABM.']);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $contentcat = Content_category::findOrFail($id);
     $this->validate($request, ['title' => 'required', 'description' => 'required']);
     $input = $request->all();
     $contentcat->fill($input)->save();
     Session::flash('flash_message', 'Kategorie byla upravena.');
     return redirect()->back();
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $contentMenu = ['content' => 'active open'];
     $page = Page::findOrFail($id);
     $category = Content_category::where('type', '=', 'page')->orderBy('id')->pluck('title', 'id');
     $users_editor = User::orderBy('name')->pluck('name', 'id');
     //return view('backend.pages.edit')->with('page',$page);
     return view('backend.pages.edit', compact('page', 'category', 'users_editor', 'contentMenu'));
 }
 /**
  * stranka - show in frontend
  * @param  string $id -id Post
  * @return Response
  */
 public function catslug($catSlug)
 {
     //$page = Page::findOrFail($id);
     $contentID = Content_category::where('slug', '=', $catSlug)->first();
     $slugID = $contentID->id;
     $categoryName = $contentID->title;
     $pagesBySlugID = Page::where('content_category_id', '=', $slugID)->where('status', '=', 'open')->get();
     return view('frontend.categoryAll', compact('pagesBySlugID', 'categoryName'));
 }