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


PHP Category::destroy方法代码示例

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


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

示例1: destroy

 public function destroy(Request $request, Category $categories, Product $products)
 {
     $id = $request->category_id;
     //Проверяет наличие потомков заданной категории
     $category = $categories->checkByChild($id);
     //Проверяет наличие товаров в заданной категории
     $product = $products->checkByCategories($id);
     if (!empty($category) or !empty($product)) {
         return redirect()->back()->with('message', "<script>alert('Нельзя удалить категорию, в которой есть дочерние элементы или в которой есть товары')</script>");
     } else {
         Category::destroy($id);
         return redirect()->back();
     }
 }
开发者ID:DimaPikash,项目名称:eshop,代码行数:14,代码来源:CategoryController.php

示例2: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     return redirect(route('admin.category.index'));
 }
开发者ID:MedElans,项目名称:library,代码行数:11,代码来源:CategoriesController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     return redirect('/back/goals');
 }
开发者ID:Cheddam,项目名称:health,代码行数:11,代码来源:CategoryController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $category = Category::findOrFail(Input::get('id'));
     } catch (Exception $e) {
         return Redirect::to('/admin.categories/')->with('flash_message', 'Category not found');
     }
     # Note there's a `deleting` Model event which makes sure
     //category_equipmemt entries are also destroyed
     # See Category.php for more details
     Category::destroy(Input::get('id'));
     return Redirect::action('CategoriesController@index')->with('flash_message', 'Your Category has been deleted.');
 }
开发者ID:nnoel2626,项目名称:MtsRental,代码行数:19,代码来源:CategoriesController.php

示例5: destroy

 /**
  * Elimina la cateogira de la BD
  *
  * @param int id
  */
 public function destroy($id)
 {
     Category::destroy($id);
     return redirect()->route('categories.index');
 }
开发者ID:Kenneth058,项目名称:adminclubinnova,代码行数:10,代码来源:CategoryController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     return 'deleted successfully.';
 }
开发者ID:RenQilei,项目名称:finalProject,代码行数:11,代码来源:CategoryController.php

示例7: destroy

 public function destroy($id)
 {
     Category::destroy($id);
     return redirect('category/index');
 }
开发者ID:Nartub600,项目名称:equilibrium,代码行数:5,代码来源:CategoryController.php

示例8: deleteCategoryPost

 public function deleteCategoryPost(Request $request)
 {
     $user = Auth::user();
     if ($user != null && $user->hasRole('admin')) {
         $validator = Validator::make($request->all(), array('category' => 'required'));
         if ($validator->fails()) {
             return redirect('admin/add-category');
         } else {
             $result = Category::destroy($request->category);
             return redirect('admin/add-category');
         }
     } else {
         return view('admin.login');
     }
 }
开发者ID:ShehabSunny,项目名称:ProductZap,代码行数:15,代码来源:AdminController.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request)
 {
     foreach ($request->input('to_delete') as $item_id) {
         Category::destroy($item_id);
     }
     Session::flash('message', 'Categoría borrada Correctamente');
     return Redirect::to('categories');
 }
开发者ID:lautaruni,项目名称:billboard,代码行数:14,代码来源:CategoryController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     flash()->success('Success!', 'Category has been deleted!');
     return redirect('categories');
 }
开发者ID:amolkattel,项目名称:Asset-Mgnt-Project,代码行数:12,代码来源:CategoriesController.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     return redirect()->back();
 }
开发者ID:alexdachin,项目名称:phppos,代码行数:11,代码来源:CategoryController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param Request $request
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, int $id)
 {
     Category::destroy($id);
     return back()->with('success', 'Delete successful');
 }
开发者ID:kapokyue,项目名称:laravel-pizza,代码行数:13,代码来源:CategoryController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
     Session::flash('flash_message', 'Category deleted!');
     return redirect('admin/category');
 }
开发者ID:ercancavusoglu,项目名称:CRUD-Ecommerce,代码行数:13,代码来源:CategoryController.php

示例14: delete

 public function delete($id)
 {
     Category::destroy($id);
     return \Redirect('/admin/categories')->with(['flash_message' => 'Category has been Successfully removed', 'flash-warning' => true]);
 }
开发者ID:omasterdesign,项目名称:omasterdefault,代码行数:5,代码来源:CategoryController.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Category::destroy($id);
 }
开发者ID:roopunk,项目名称:fashionove,代码行数:10,代码来源:CategoriesController.php


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