App\Http\Controllers\EditorController::fileDestroy PHP Method

fileDestroy() public method

file destory
public fileDestroy ( Storage $storage, string $instanceId, string $id ) : Xpressengine\Presenter\RendererInterface
$storage Xpressengine\Storage\Storage
$instanceId string
$id string
return Xpressengine\Presenter\RendererInterface
    public function fileDestroy(Storage $storage, $instanceId, $id)
    {
        if (empty($id) || !($file = File::find($id))) {
            throw new InvalidArgumentException();
        }
        if ($file->userId !== Auth::id()) {
            throw new AccessDeniedHttpException();
        }
        try {
            $result = $storage->remove($file);
        } catch (\Exception $e) {
            $result = false;
        }
        return XePresenter::makeApi(['deleted' => $result]);
    }