/** * Generate a URL to an application asset. * * @param string $path * @param bool $secure * @return string */ protected function configAssetUrl($path, $secure = null) { static $assetUrl; // Remove this. $i = 'index.php'; if (URL::isValidUrl($path)) { return $path; } // Finding asset url config. if (is_null($assetUrl)) { $assetUrl = \Config::get('theme.assetUrl', ''); } // Using asset url, if available. if ($assetUrl) { $base = rtrim($assetUrl, '/'); // Asset URL without index. $basePath = str_contains($base, $i) ? str_replace('/' . $i, '', $base) : $base; } else { if (is_null($secure)) { $scheme = Request::getScheme() . '://'; } else { $scheme = $secure ? 'https://' : 'http://'; } // Get root URL. $root = Request::root(); $start = starts_with($root, 'http://') ? 'http://' : 'https://'; $root = preg_replace('~' . $start . '~', $scheme, $root, 1); // Asset URL without index. $basePath = str_contains($root, $i) ? str_replace('/' . $i, '', $root) : $root; } return $basePath . '/' . $path; }
public function anyIndex() { //获取路由传入的参数 //echo Route::input('name'); //获取配置信息 $value = config('app.timezone'); //var_dump($value); //获取请求输入 http://host-8/web/user?name=dfse 输出:dfse $name1 = Request::has('name') ? Request::get('name') : ''; //取得特定输入数据,若没有则取得默认值 $name2 = Request::input('name', '默认值'); $input = Request::all(); //所有的 $input = Request::input('products.0.name'); //重定向 //return redirect('login'); //获取cookie $value = Request::cookie('name'); //获取域名 $url = Request::root(); // echo $url; $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value]; //响应视图 响应最常用的几个方法:make/view/json/download/redirectTo return response()->view('user.user', $data); }
/** * Returns the setup page. * * @return \Illuminate\View\View */ public function getIndex() { // If we've copied the .env.example file, then we should try and reset it. if (getenv('APP_KEY') === 'SomeRandomString') { $this->keyGenerate(); } return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withAppUrl(Request::root()); }
/** * Returns the setup page. * * @return \Illuminate\View\View */ public function getIndex() { // If we've copied the .env.example file, then we should try and reset it. if (getenv('APP_KEY') === 'SomeRandomString') { $this->keyGenerate(); } return View::make('setup')->with(['page_title' => trans('setup.setup'), 'cacheDrivers' => $this->cacheDrivers, 'appUrl' => Request::root()]); }
/** * Returns the setup page. * * @return \Illuminate\View\View */ public function getIndex() { $supportedLanguages = Request::getLanguages(); $userLanguage = Config::get('app.locale'); foreach ($supportedLanguages as $language) { $language = str_replace('_', '-', $language); if (isset($this->langs[$language])) { $userLanguage = $language; break; } } return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withMailDrivers($this->mailDrivers)->withUserLanguage($userLanguage)->withAppUrl(Request::root()); }
/** * Returns the setup page. * * @return \Illuminate\View\View */ public function getIndex() { // If we've copied the .env.example file, then we should try and reset it. if (strlen(Config::get('app.key')) !== 32) { $this->keyGenerate(); } $supportedLanguages = Request::getLanguages(); $userLanguage = Config::get('app.locale'); foreach ($supportedLanguages as $language) { $language = str_replace('_', '-', $language); if (isset($this->langs[$language])) { $userLanguage = $language; break; } } return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withUserLanguage($userLanguage)->withAppUrl(Request::root()); }
/** * check if package is surpassed or not then * prepare the path before generating the url. * * @param $path * @param string $prepend * * @return mixed */ private function generateUrl($path, $prepend = '') { // if the package is surpassed, then return the same $path // to load the asset from the localhost if (isset($this->configurations['bypass']) && $this->configurations['bypass']) { return Request::root() . '/' . $path; } if (!isset($path)) { throw new EmptyPathException('Path does not exist.'); } // Add version number //$path = str_replace( // "build", // $this->configurations['providers']['aws']['s3']['version'], // $path //); // remove slashes from begging and ending of the path // and append directories if needed $clean_path = $prepend . $this->helper->cleanPath($path); // call the provider specific url generator return $this->provider->urlGenerator($clean_path); }
/** * Defines the Form Back Button destination * @return string */ protected function returnTo() { $fallback = Request::root() . "/" . Request::segment(1); if (explode("?", $this->_referer)[0] == $fallback) { return "javascript:history.go(-1)"; } else { return $fallback; } }