本文整理汇总了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();
}
}
示例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'));
}
示例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');
}
示例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.');
}
示例5: destroy
/**
* Elimina la cateogira de la BD
*
* @param int id
*/
public function destroy($id)
{
Category::destroy($id);
return redirect()->route('categories.index');
}
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Category::destroy($id);
return 'deleted successfully.';
}
示例7: destroy
public function destroy($id)
{
Category::destroy($id);
return redirect('category/index');
}
示例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');
}
}
示例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');
}
示例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');
}
示例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();
}
示例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');
}
示例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');
}
示例14: delete
public function delete($id)
{
Category::destroy($id);
return \Redirect('/admin/categories')->with(['flash_message' => 'Category has been Successfully removed', 'flash-warning' => true]);
}
示例15: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Category::destroy($id);
}