Esempio n. 1
0
 public function getDelete($id)
 {
     $categorie = catdb::find($id);
     $categorie->delete();
     Session::flash('success', "La catégorie {$categorie->title} a bien été supprimé. ");
     return Redirect::route('category.index');
 }
Esempio n. 2
0
 public function delete($id)
 {
     Category::find($id)->delete();
     Category::where('pid', $id)->delete();
     $ret['meta']['code'] = 1;
     echo json_encode($ret);
 }
Esempio n. 3
0
 public function show($id = 0)
 {
     if (!preg_match("/^[1-9]\\d*\$/", $id)) {
         return Redirect::to('/');
     }
     $type = Category::find($id);
     if (empty($type)) {
         return Redirect::to('/');
     }
     $keywords = $type->keywords;
     $description = $type->description;
     $subs = $type->subs()->get();
     if (count($subs) > 0) {
         $templet = 'sub';
         if ($type->templet_all != '') {
             $templet = $type->templet_all;
         }
         return Theme::view('category.' . $templet, compact('type', 'subs', 'keywords', 'description'));
     } else {
         $templet = 'show';
         if ($type->templet_nosub != '') {
             $templet = $type->templet_nosub;
         }
         $articles = Article::where('category_id', $id)->sortByDesc('id')->paginate(20);
         return Theme::view('category.' . $templet, compact('type', 'articles', 'keywords', 'description'));
     }
 }
Esempio n. 4
0
 public function show($id = 0)
 {
     if (!preg_match("/^[1-9]\\d*\$/", $id)) {
         return Redirect::to('/');
     }
     $article = Article::find($id);
     if (empty($article)) {
         return Redirect::to('/');
     }
     $type = Category::find($article->category_id);
     if (empty($type)) {
         return Redirect::to('/');
     }
     ++$article->views;
     $article->save();
     $keywords = $article->keywords;
     $description = $article->description;
     if ($article->url != '') {
         return Redirect::to($article->url);
     }
     $templet = 'show';
     if ($type->templet_article != '') {
         $templet = $type->templet_article;
     }
     return Theme::view('article.' . $templet, compact('article', 'type', 'keywords', 'description'));
 }
 public function getType($id)
 {
     $id = intval($id);
     $articles = Article::where('category_id', $id)->sortByDesc('id')->paginate(20);
     $categories = Category::where('is_nav_show', '>', '0')->sortByDesc('id')->get();
     $type = Category::find($id);
     return Theme::view('admin.articles.index', compact(['articles', 'categories', 'type']));
 }
Esempio n. 6
0
 public function show($id)
 {
     if (!preg_match("/^[1-9]\\d*\$/", $id)) {
         return Redirect::to('/');
     }
     $type = Category::find($id);
     if (!$type) {
         return Redirect::to(route('admin.projects.index'));
     }
     $projects = Project::where('category_id', $id)->sortByDesc('id')->paginate(20);
     return Theme::view('admin.projects.show', compact('projects', 'type'));
 }
Esempio n. 7
0
 public function edit($id)
 {
     if (!preg_match("/^[1-9]\\d*\$/", $id)) {
         return Redirect::to('/');
     }
     $category = Category::find($id);
     if (!$category) {
         return Redirect::to(route('admin.category.index'));
     }
     if ($category->hash == '') {
         $category->hash = Hash::make(time() . rand(1000, 9999));
     }
     return Theme::view('admin.category.edit', compact('category'));
 }
Esempio n. 8
0
 public function show($id = 0)
 {
     if (!preg_match("/^[1-9]\\d*\$/", $id)) {
         return Redirect::to('/');
     }
     $project = Project::find($id);
     if (empty($project)) {
         return Redirect::to('/');
     }
     $type = Category::find($project->category_id);
     if (empty($type)) {
         return Redirect::to('/');
     }
     ++$project->views;
     $project->save();
     $keywords = $project->keywords;
     $description = $project->description;
     if ($project->url != '') {
         return Redirect::to($project->url);
     }
     return Theme::view('project.show', compact('project', 'type', 'keywords', 'description'));
 }
Esempio n. 9
0
 public function delete()
 {
     $id = Input::get('id');
     $validator = Validator::make(array('id' => $id), array('id' => 'required|integer'));
     if ($validator->fails()) {
         return $this->responseJson(false, $validator->messages(), 101);
     }
     $category = Category::find($id);
     if (!$category) {
         return $this->responseJson(false, "不存在该分类!", 102);
     }
     $childdrenCategory = Category::where('parent_id', $id)->first();
     if (!count($childdrenCategory)) {
         return $this->responseJson(false, "该分类存在子分类!", 103);
     }
     $article = $category->article->first();
     if (count($article)) {
         return $this->responseJson(false, "该分类下存在文章!", 104);
     }
     $res = $category->delete();
     if (!$res) {
         return $this->responseJson(false, "删除分类失败!", 199);
     }
     return $this->responseJson(true, '删除分类成功!', 200);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     //
     return backendView('edit')->withCate(Category::find($id));
 }
Esempio n. 11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     return response()->view('frontend.article', Category::find($id));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $productobj = new Product();
     $product = $productobj->find($id);
     $productCategories = Category::all();
     $productCategId = Category::find($product->category_id);
     $moduleId = 2;
     //product
     //get the image assiociates
     $prodFiles = Files::where('attachment_id', $product->id)->where('is_active', True)->where('module_id', $moduleId)->get();
     //materials sesction
     //get all materials associated
     $curMaterials = array();
     $curMatIds = array();
     $prodMaterials = Product::find($id)->materials()->get();
     foreach ($prodMaterials as $pm) {
         //gets the current set materials
         $matExtObject = Material::where('is_active', true)->where('id', $pm->material_id)->first();
         array_push($curMaterials, $matExtObject);
         array_push($curMatIds, $pm->material_id);
         $matExtObject = null;
     }
     //get all the materials not in current product
     $allMaterials = Material::whereNotIn('id', $curMatIds)->orderBy('material_name', 'asc')->get();
     //subproducts section
     //get all subproducts associated
     $curSubProducts = array();
     $curSubProductIds = array();
     $subProducts = Product::find($id)->sub_products()->get();
     foreach ($subProducts as $pm) {
         //gets the current set materials
         $subprodExtObject = SubProduct::where('is_active', true)->where('id', $pm->sub_product_id)->first();
         array_push($curSubProducts, $subprodExtObject);
         array_push($curSubProductIds, $pm->sub_product_id);
         $subprodExtObject = null;
     }
     //get all the subproducts not in current main product
     $allSubProducts = SubProduct::whereNotIn('id', $curSubProductIds)->orderBy('sub_product_name', 'asc')->get();
     return view('pages.admin.product.edit', ['product' => $product, 'productCategories' => $productCategories, 'productCategId' => $productCategId, 'prodFiles' => $prodFiles, 'allMaterials' => $allMaterials, 'curMaterials' => $curMaterials, 'allSubProducts' => $allSubProducts, 'curSubProducts' => $curSubProducts, 'moduleId' => $moduleId]);
 }
Esempio n. 13
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     return view('admin.category.edit', ['categories' => $this->getCategoryDropboxs(), 'category' => Category::find($id)]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $categobj = new Category();
     $categ = $categobj->find($id);
     return view('pages.admin.category.edit', ['category' => $categ]);
 }
Esempio n. 15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // try {
     // 	$category = Category::findOrFail($id)->delete();
     // 	return redirect('admin/category');
     // } catch (Exception $e) {
     // 	return abort(404);
     // }
     $category = Category::find($id);
     $category->delete();
 }
Esempio n. 16
0
 public function delete($id)
 {
     Category::find($id)->delete();
     return redirect("/dream/category")->with('message', '信息删除成功!');
 }
 public function postDelete($id)
 {
     $id = intval($id);
     $type = Category::find($id);
     if (!$type) {
         return Redirect::to('/admin/categories');
     }
     $type->delete();
     return Response::json(['error' => 0, 'message' => '删除成功!']);
 }