public function delete(Request $request, Category $category)
 {
     $category->delete();
     if ($request->isXmlHttpRequest()) {
         return response(json_encode(['success' => true]))->header('Content-type', 'application/json');
     } else {
         return redirect('/category');
     }
 }
Example #2
0
 /**
  * Remove the specified category from storage.
  *
  * @param  Category $category
  * @return \Illuminate\Http\JsonResponse
  */
 public function destroy($category)
 {
     $category->delete();
 }
Example #3
0
 /**
  * Xóa
  *
  * @param  Category  $category
  * @return Response
  */
 public function destroy(Category $category)
 {
     \File::delete(public_path(config("image.paths") . 'categories/large' . $category->image));
     $category->delete();
     return redirect('admin/category')->with('flash_message', config('blog.message.deleted'));
 }
 /**
  * Delete a category
  *
  * @param Category $category
  * @return array
  * @throws \Exception
  */
 public function deleteCategory(Category $category)
 {
     $ids = Category::where('parent_id', '=', $category->id)->get()->lists('id')->toArray();
     Category::destroy($ids);
     return $category->delete() ? ["status" => "success", "message" => "分类删除成功"] : ["status" => "error", "message" => "分类删除失败, 请重试"];
 }
 /**
  * Remove the specified category from storage.
  *
  * @param  Category  $category
  * @return Response
  */
 public function destroy(Category $category)
 {
     $category->delete() ? Flash::success(trans('admin.delete.success')) : Flash::error(trans('admin.delete.fail'));
     return redirect(route('admin.category.index'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Category $category)
 {
     try {
         $category->delete();
     } catch (QueryException $e) {
         return redirect('categories')->with('error', 'You cant delete that category its been used.');
     }
     return redirect('categories');
 }
Example #7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Category $category)
 {
     // Delete the $category
     $category->delete();
     flash()->success('Category has beed deleted');
     return redirect('categories');
 }
 public function destroy(Category $category)
 {
     $deleted = $category->delete();
     $message = $deleted ? 'Categoria eliminada' : 'Error al eliminar';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  Categories $category
  * @return Response
  */
 public function destroy(Category $category)
 {
     $category->delete();
     return Redirect::route('categories.index')->with('message', 'Category deleted.');
 }
Example #10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Category $category)
 {
     $deleted = $category->delete();
     $message = $deleted ? 'Category was removed succesfully' : 'Could not remove category';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
Example #11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Category $category
  * @return \Illuminate\Http\Response
  */
 public function destroy(Category $category)
 {
     $category->delete();
     return redirect(action('Admin\\CategoryController@index'))->with('success', 'deleted');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  Categories $category
  * @return Response
  */
 public function destroy(Category $category)
 {
     \DB::transaction(function () use($category) {
         $category->delete();
         $this->categoryPAndCObj->where('child_id', '=', $category->id)->orWhere('parent_id', '=', $category->id)->delete();
         \DB::table('member_categories')->where('category_id', '=', $category->id)->delete();
     });
     return Redirect::route('categories.index')->with('message', 'Category deleted.');
 }
Example #13
0
 /**
  * Created By Dara on 14/2/2016
  * subCategory delete
  */
 public function subCategoryDelete(Category $category, Category $subCategory)
 {
     $subCategory->delete();
     Flash::success(trans('users.subCategoryDeleted'));
     return redirect(route('admin.category.subCategory.index', [$category->id]));
 }
Example #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Category $category)
 {
     if ($category) {
         $category->delete();
         return Redirect::to('categories')->with('message', 'Category Deleted');
     }
     return Redirect::to('categories')->with('message', 'something went wrong, please try again');
 }
Example #15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Category $category)
 {
     $deleted = $category->delete();
     $message = $deleted ? 'Categoría eliminada correctamente!' : 'La Categoría NO pudo eliminarse!';
     return redirect()->route('admin.category.index')->with('message', $message);
 }