/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = [];
     $data['menu'] = Menu::findOrFail($id);
     $data['menus'] = Menu::findAllWithParent();
     $data['contents'] = Content::select('id', 'title')->where('state', 1)->lists('title', 'id')->prepend('Select a content', '')->toArray();
     $data['categories'] = Cat::select('id', 'name')->lists('name', 'id')->prepend('Select a category', '')->toArray();
     return view('admin.menu.form', $data);
 }
 /**
  * Compose left navigation for admin left menu
  */
 private function composeLeftNavigation()
 {
     view()->composer('admin.shared.left', function ($view) {
         $total = new \stdClass();
         $total->menu = Menu::count();
         $total->category = Cat::count();
         $total->content = Content::count();
         $view->with('total', $total);
     });
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $categories = Cat::select('id', 'name')->lists('name', 'id')->toArray();
     $content = Content::findOrFail($id);
     if ($this->remove_additional_field_flag == false) {
         $additional_fields = (array) json_decode($content->content_types);
     }
     $contents = Content::buildContentArray($content);
     return view('admin.content.form', compact('categories', 'additional_fields', 'content', 'contents'));
 }
 /**
  * Unpublish items
  *
  * @param  UpdateStateRequest $request
  * @return \Illuminate\Http\Response
  */
 public function unpublish(UpdateStateRequest $request)
 {
     $items = $request->input('items');
     $request->session()->flash('alert-success', 'Selected categories has been unpublished!');
     return Cat::whereIn('id', $items)->update(['state' => 0]);
 }