当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::delete方法代码示例

本文整理汇总了PHP中app\Category::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::delete方法的具体用法?PHP Category::delete怎么用?PHP Category::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Category的用法示例。


在下文中一共展示了Category::delete方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 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');
     }
 }
开发者ID:rajinha92,项目名称:laravel-skills-test2,代码行数:9,代码来源:CategoryController.php

示例2: destroy

 /**
  * Remove the specified category from storage.
  *
  * @param  Category $category
  * @return \Illuminate\Http\JsonResponse
  */
 public function destroy($category)
 {
     $category->delete();
 }
开发者ID:lolzballs,项目名称:website,代码行数:10,代码来源:CategoryController.php

示例3: destroy

 /**
  * 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'));
 }
开发者ID:khanhpnk,项目名称:hocvet,代码行数:12,代码来源:CategoryController.php

示例4: deleteCategory

 /**
  * 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" => "分类删除失败, 请重试"];
 }
开发者ID:CaliProject,项目名称:mikenong-dev,代码行数:13,代码来源:ManageController.php

示例5: destroy

 /**
  * 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'));
 }
开发者ID:ungly,项目名称:laravel-5-simple-cms,代码行数:11,代码来源:CategoryController.php

示例6: destroy

 /**
  * 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');
 }
开发者ID:Tisho84,项目名称:laravel-work,代码行数:15,代码来源:CategoriesController.php

示例7: destroy

 /**
  * 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');
 }
开发者ID:kakapa,项目名称:erpbox,代码行数:13,代码来源:CategoriesController.php

示例8: destroy

 public function destroy(Category $category)
 {
     $deleted = $category->delete();
     $message = $deleted ? 'Categoria eliminada' : 'Error al eliminar';
     return redirect()->route('admin.category.index')->with('message', $message);
 }
开发者ID:aleksAE,项目名称:Store-Laravel5.1,代码行数:6,代码来源:CategoryController.php

示例9: destroy

 /**
  * 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.');
 }
开发者ID:nowarena,项目名称:laravel,代码行数:11,代码来源:CategoriesController.php

示例10: destroy

 /**
  * 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);
 }
开发者ID:AcarMeel,项目名称:store,代码行数:12,代码来源:CategoryController.php

示例11: destroy

 /**
  * 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');
 }
开发者ID:Tisho84,项目名称:conference,代码行数:11,代码来源:CategoryController.php

示例12: destroy

 /**
  * 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.');
 }
开发者ID:nowarena,项目名称:homestead,代码行数:15,代码来源:CategoriesController.php

示例13: subCategoryDelete

 /**
  * 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]));
 }
开发者ID:emadmrz,项目名称:tinker,代码行数:10,代码来源:CategoryController.php

示例14: destroy

 /**
  * 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');
 }
开发者ID:shima-rahman,项目名称:lina,代码行数:14,代码来源:CategoryController.php


注:本文中的app\Category::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。