destroy data of the eloquent model or models

@param \Illuminate\Database\Eloquent\Model|array $model [Model|ids]
@param string|null $path
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
182379
public function destroyModel($model, $path = null)
    {
        $this->model = $model;
        try {
            if ( ! $this->model->delete()) {
                throw new DestroyException($this->model);
            }

            event(new $this->events['success']($this->model));

            if (is_null($path)) {
                return response()->json($this->returnData('success'));
            }
            Flash::success(trans('laravel-modules-base::admin.flash.destroy_success'));
            return $this->redirectRoute($path);
        } catch (DestroyException $e) {
            event(new $this->events['fail']($e->getDatas()));

            if (is_null($path)) {
                return response()->json($this->returnData('error'));
            }
            Flash::error(trans('laravel-modules-base::admin.flash.destroy_error'));
            return $this->redirectRoute($path);
        }
    }
1275622
public function destroy($id)
    {
        $files = $this->repository->find($id);

        if (empty($files)) {
            Cms::notification('File not found', 'warning');

            return redirect(route($this->routeBase.'.files.index'));
        }

        if (is_file(storage_path($files->location))) {
            Storage::delete($files->location);
        } else {
            Storage::disk(config('cms.storage-location', 'local'))->delete($files->location);
        }

        $files->delete();

        Cms::notification('File deleted successfully.', 'success');

        return redirect(route($this->routeBase.'.files.index'));
    }
1146626
public function redirect(ActiveRecord $model = null)
    {
        $route = $this->redirectTo;
        $controller = $this->controller;
        $request = Yii::$app->getRequest();

        // if callable
        if ($model && $route instanceof \Closure) {
            $route = call_user_func($route, $model);
        }

        if ($route === null) {
            return $request->getReferrer() ?
                $controller->redirect($request->getReferrer()) : $controller->goHome();
        }

        return $controller->redirect($route);
    }
1349404
public function delete($path)
    {
        return Response::parseResponse(
            $this->getCos()->delFile($this->getBucket(), PathLibrary::normalizerPath($path))
        ) != false ;
    }
1134637
public function delete($path)
    {
        try {
            $response = $this->api->deleteResources([$path]);

            return $response['deleted'][$path] === 'deleted';
        } catch (Api\Error $e) {
            return false;
        }
    }
1086765
public function destroy(Request $request, $id)
    {
        $this->slug = $this->getSlug($request);
        if (!$this->can('delete-' . Str::plural($this->slug), auth()->user()->id)) {
            abort(404);
        }
        Laramin::model($this->type->name)->find($id)->delete();

        Session::flash($this->flashname, $this->SessionMessage("Your {$this->slug} Has Been Succesfully Destroyed", 'success'));

        return redirect()->route("laramin.{$this->slug}.index");
    }
714425
public function destroy($id, Request $request)
    {
        $category = $this->model()->find($id);

        if (!$category->threads->isEmpty() || !$category->children->isEmpty()) {
            return $this->buildFailedValidationResponse($request, trans('forum::validation.category_is_empty'));
        }

        return $this->deleteModel($category, 'delete');
    }
656841
public function delete ($path) {
		list ($first, $rest) = self::getFirstAndRestPathElements($path);

		# If we are going still deeper...
		if (!is_null($rest)) {
			if (array_key_exists($first, $this -> data)) {
				if ($this -> data[$first] instanceof MutableTreeInterface) {
					/** @var MutableTreeInterface $tree */
					$tree = $this -> data[$first];
					$tree -> delete($rest);
				} else {
					throw new InvalidKeyException("Value at key `" . $first . "` is a scalar; cannot step further down the requested path `" . $rest . "`");
				}
			} else {
				throw new NonExistentKeyException("Key `" . $first . "` does not exist.");
			}
		} else {
			unset($this -> data[$first]);
		}

		return $this;
	}
503887
public function destroy($id)
    {
        $image = $this->repository->find($id);

        if (is_file(storage_path($image->location))) {
            Storage::delete($image->location);
        } else {
            Storage::disk(Config::get('cms.storage-location', 'local'))->delete($image->location);
        }

        if (empty($image)) {
            Cms::notification('Image not found', 'warning');

            return redirect(route($this->routeBase.'.images.index'));
        }

        $image->forgetCache();
        $image->delete();

        Cms::notification('Image deleted successfully.', 'success');

        return redirect(route($this->routeBase.'.images.index'));
    }
213344
public function delete(string $path, $callback, ...$args): FrameworkHandler
    {
        return $this->route('delete', $path, $callback, ...$args);
    }
1312714
public function delete($path, $callback)
    {
        Argument::i()
            //argument 1 should be a string
            ->test(1, 'string')
            //argument 2 should be callable
            ->test(2, 'callable');
        
        return $this->route('delete', $path, $callback);
    }
327231
public function deleteStyle($href, $path = null)
    {
        $key = $this->calculateKey($href, $path);
        if (isset($this->styles[$key])) {
            unset($this->styles[$key]);
        }

        return $this;
    }
627787
public function delete(String $path, Callable $callback) : Route {

		return $this->collectRoute('DELETE', $path, $callback);

	}
1155120
public function delete($path)
    {
        $result = Uploader::destroy($path, ['invalidate' => true]);

        return is_array($result) ? $result['result'] == 'ok' : false;
    }
169574
public function destroy(Request $request, $id)
    {
        $slug = $this->getSlug($request);

        $dataType = Admin::model('DataType')->where('slug', '=', $slug)->first();

        // Check permission
        $this->authorize('delete', app($dataType->model_name));

        // Init array of IDs
        $ids = [];
        if (empty($id)) {
            // Bulk delete, get IDs from POST
            $ids = explode(',', $request->ids);
        } else {
            // Single item delete, get ID from URL or Model Binding
            $ids[] = $id instanceof Model ? $id->{$id->getKeyName()} : $id;
        }
        foreach ($ids as $id) {
            $data = call_user_func([$dataType->model_name, 'findOrFail'], $id);
            $this->cleanup($dataType, $data);
        }

        $displayName = count($ids) > 1 ? $dataType->display_name_plural : $dataType->display_name_singular;

        $res = $data->destroy($ids);

        $data = $res
            ? [
                'message'    => __('admin.generic.successfully_deleted')." {$displayName}",
                'alert-type' => 'success',
            ]
            : [
                'message'    => __('admin.generic.error_deleting')." {$displayName}",
                'alert-type' => 'error',
            ];

        if ($res) {
            event(new CrudDataDeleted($dataType, $data, $ids));
        }

        $requestQuery = (object) $request->query();

        if ($dataType->isBackToParentCrud($requestQuery)) {
            return redirect()
                ->route("admin.{$requestQuery->crud_slug}.{$requestQuery->crud_action}", $requestQuery->crud_id)
                ->with([
                    'message'    => __('admin.generic.successfully_added_new')." {$dataType->display_name_singular}",
                    'alert-type' => 'success',
                ]);
        }

        return redirect()->route("admin.{$dataType->slug}.index", $request->query())->with($data);
    }
1188128
public function delete($path)
    {
        $paths = is_array($path) ? $path : func_get_args();

        $success = true;

        foreach ($paths as $path) {

            if ($this->isDirectory($path)) {
                $success = $this->laravelFS->deleteDirectory($path);
                continue;
            }
            $success = $this->laravelFS->delete($path);

        }

        return $success;
    }
270941
public function destroy(Message $message)
    {
        $this->authorize('delete', $message);
        $message->delete();

        return redirect()->route('laralum::tickets.show', ['ticket' => $message->ticket->id]);
    }