public function getCategories(CategoryRepositoryInterface $repositoryInterface, $type) { $categories = $repositoryInterface->getByType('news'); $return = array(); foreach ($categories as $category) { $return[] = array('id' => "{$category->id}", 'name' => $category->translation->where('lang_id', 1)->first()->value); } return json_encode($return); }
/** * Remove the specified resource from storage. * * @param CategoryRepositoryInterface $repositoryInterface * @param int $id * @return Response */ public function destroy(CategoryRepositoryInterface $repositoryInterface, $id) { if ($repositoryInterface->delete($id)) { Message::success('Categoria eliminada'); return redirect()->route($this->admin_route); } Message::danger('Erro a eliminar a categoria'); return back(); }
/** * Show the form for editing the specified resource. * * @param NewsRepositoryInterface $repositoryInterface * @param CategoryRepositoryInterface $categoryRepositoryInterface * @param int $id * @return Response */ public function edit(NewsRepositoryInterface $repositoryInterface, CategoryRepositoryInterface $categoryRepositoryInterface, $id) { $categories = $categoryRepositoryInterface->getByType('news'); $news = $repositoryInterface->getById($id); return view('admin.news.edit', compact('news', 'categories')); }
/** * Show the form for editing the specified resource. * * @param CategoryRepositoryInterface $categoryRepositoryInterface * @param SupportRepositoryInterface $repositoryInterface * @param int $id * @return Response */ public function edit(CategoryRepositoryInterface $categoryRepositoryInterface, SupportRepositoryInterface $repositoryInterface, $id) { $categories = $categoryRepositoryInterface->getByType('support'); $support = $repositoryInterface->getById($id); return view('admin.support.edit', compact('support', 'categories')); }
/** * Show the form for editing the specified resource. * * @param CategoryRepositoryInterface $categoryRepositoryInterface * @param SpecRepositoryInterface $repositoryInterface * @param int $id * @return Response */ public function edit(CategoryRepositoryInterface $categoryRepositoryInterface, SpecRepositoryInterface $repositoryInterface, $id) { $categories = $categoryRepositoryInterface->getByType('spec'); $spec = $repositoryInterface->getById($id); return view('admin.spec.edit', compact('spec', 'categories')); }