/** * Module Assets. * * @param string $module Module name * @param string $path Asset path * @param string $contentType Content type * * @return string */ public function moduleAsset($module, $path, $contentType = 'null') { $path = base_path(Config::get('quarx.module-directory') . '/' . ucfirst($module) . '/Assets/' . $path); return url('quarx/asset/' . CryptoServiceFacade::url_encode($path) . '/' . CryptoServiceFacade::url_encode($contentType) . '/?isModule=true'); }
/** * Gets an asset. * * @param string $encPath * @param string $contentType * * @return Provides the valid */ public function asset($encPath, $contentType, Filesystem $fileSystem) { try { $path = CryptoServiceFacade::url_decode($encPath); if (Request::get('isModule') === 'true') { $filePath = $path; } else { $filePath = __DIR__ . '/../Assets/' . $path; } $fileName = basename($filePath); if (!is_null($contentType)) { $contentType = CryptoServiceFacade::url_decode($contentType); } else { $contentType = $fileSystem->mimeType($fileName); } $headers = ['Content-Type' => $contentType]; return response()->download($filePath, $fileName, $headers); } catch (Exception $e) { return Response::make('file not found'); } }