本文整理汇总了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');
}
}
示例2: destroy
/**
* Remove the specified category from storage.
*
* @param Category $category
* @return \Illuminate\Http\JsonResponse
*/
public function destroy($category)
{
$category->delete();
}
示例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'));
}
示例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" => "分类删除失败, 请重试"];
}
示例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'));
}
示例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');
}
示例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');
}
示例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);
}
示例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.');
}
示例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);
}
示例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');
}
示例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.');
}
示例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]));
}
示例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');
}