/**
  * To update a page
  * @param type $slug 
  * @param type PageUpdate $request 
  * @return type redirect
  */
 public function update($slug, PageUpdate $request)
 {
     // get pages with respect to slug
     $pages = $this->page->where('slug', $slug)->first();
     $sl = $request->input('slug');
     $slug = str_slug($sl, "-");
     $this->page->slug = $slug;
     try {
         $pages->fill($request->all())->save();
         $pages->slug = $slug;
         $pages->save();
         return redirect('page')->with('success', 'Your Page Updated Successfully');
     } catch (Exception $e) {
         return redirect('page')->with('fails', $e->errorInfo[2]);
     }
 }
 /**
  * To update a page
  * @param type $id
  * @param type Request $request
  * @return type
  */
 public function update($slug, PageUpdate $request)
 {
     $pages = $this->page->where('slug', $slug)->first();
     $sl = $request->input('slug');
     $slug = str_slug($sl, "-");
     $this->page->slug = $slug;
     //$id = $page->id;
     $pages->fill($request->all())->save();
     $pages->slug = $slug;
     $pages->save();
     return redirect('page')->with('success', 'Your Page Updated Successfully');
 }