App\Http\Controllers\EditorController::fileDownload PHP 메소드

fileDownload() 공개 메소드

file download
public fileDownload ( EditorHandler $handler, Storage $storage, string $instanceId, string $id ) : void
$handler Xpressengine\Editor\EditorHandler editor handler
$storage Xpressengine\Storage\Storage storage
$instanceId string instance id
$id string
리턴 void
    public function fileDownload(EditorHandler $handler, Storage $storage, $instanceId, $id)
    {
        if (empty($id) || !($file = File::find($id))) {
            throw new InvalidArgumentException();
        }
        if (Gate::denies('download', new Instance($handler->getPermKey($instanceId)))) {
            throw new AccessDeniedHttpException();
        }
        $storage->download($file);
    }