exists($namespace . 'visitor.' . $prefix . $template)) { $view = $namespace . 'visitor.' . $prefix . $template; break; } } if (is_null($view)) { throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template); } return $view; } /** * Get URL to uploaded file * * @param $filename * * @return string */ public static function upload($filename) { // for debug environment check if file exists if (env('APP_DEBUG') && !file_exists(config('app.upload_path') . '/' . $filename)) { throw new NotFoundHttpException('File ' . $filename . ' cannot be found in ' . config('app.upload_path') . '.'); } // return url to uploaded file return config('app.upload_url') . '/' . $filename; } public static function asset($path) { if (env('APP_DEBUG')) { if (empty($path)) { throw new InvalidArgumentException('No asset name defined!'); } // check if asset exists and is file if (!file_exists(public_path('assets/' . config('app.theme') . '/' . $path))) { throw new NotFoundHttpException('Cannot find any asset in ' . public_path('assets/' . config('app.theme') . '/' . $path) . '. Try to check your paths.'); } } return config('app.url') . '/assets/' . config('app.theme') . '/' . $path; } }