Pagekit\Finder\Controller\FinderController::removeFilesAction PHP Method

removeFilesAction() public method

public removeFilesAction ( $names )
    public function removeFilesAction($names)
    {
        foreach ($names as $name) {
            if (!($path = $this->getPath($name))) {
                return $this->error(__('Invalid path.'));
            }
            if ('w' !== $this->getMode($path)) {
                throw new ForbiddenException(__('Permission denied.'));
            }
            try {
                App::file()->delete($path);
            } catch (\Exception $e) {
                return $this->error(__('Unable to remove.'));
            }
        }
        return $this->success(__('Removed selected.'));
    }