/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     try {
         $this->categoryService->validateInput($request->all(), true, $id);
     } catch (\Exception $e) {
         abort(422);
     }
     $response = $this->categoryService->update($request, $id);
     return response()->json($response);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $categories = $this->repository->orderBy('id', 'desc')->paginate(15);
     $selectedCategory = CategoryService::unlimitedForLevel($categories->toArray()['data']);
     $category = $this->repository->find($id);
     return view('backend.news.category_edit', ['category' => $category, 'selectCategory' => $selectedCategory]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data = $this->dispatch(new NewsFormFields($id));
     $category = $this->repository->getAllCategory();
     $data['selectCategory'] = CategoryService::unlimitedForLevel($category->toArray());
     //print_r($data);exit;
     return view('backend.news.edit', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $category = $this->repository->getNewsCategoryPaginated(config('custom.per_page'), 'id', 'desc');
     $selectedCategory = CategoryService::unlimitedForLevel($category->toArray()['data']);
     return view('backend.news.category', ['category' => $category, 'selectCategory' => $selectedCategory]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['news'] = $this->news->find($id);
     $categories = $this->category->all();
     $data['selectCategory'] = CategoryService::unlimitedForLevel($categories->toArray());
     return view('backend.news.edit', $data);
 }