當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。