Components\Posts\Controllers\Backend\PostCategoriesController::destroy PHP Метод

destroy() публичный Метод

Remove the specified post category from storage.
public destroy ( integer $id = null ) : Response
$id integer
Результат Response
    public function destroy($id = null)
    {
        // If multiple ids are specified
        if ($id == 'multiple') {
            $selected_ids = trim(Input::get('selected_ids'));
            if ($selected_ids == '') {
                return Redirect::back()->with('error_message', trans('error_messages.nothing_selected_delete'));
            }
            $selected_ids = explode(' ', $selected_ids);
        } else {
            $selected_ids = array($id);
        }
        foreach ($selected_ids as $id) {
            $post_cat = Category::findOrFail($id);
            $post_cat->delete();
        }
        if (count($selected_ids) > 1) {
            $message = trans('success_messages.post_cats_delete');
        } else {
            $message = trans('success_messages.post_cat_delete');
        }
        return Redirect::to("backend/{$post_cat->type}-categories")->with('success_message', $message);
    }