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