当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::root方法代码示例

本文整理汇总了PHP中Illuminate\Http\Request::root方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::root方法的具体用法?PHP Request::root怎么用?PHP Request::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::root方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compose

 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     $view->cruddyData = $this->cruddy->data();
     $view->cruddyData += ['schemaUrl' => $this->url->route('cruddy.schema'), 'thumbUrl' => $this->url->route('cruddy.thumb'), 'baseUrl' => $this->url->route('cruddy.home'), 'root' => $this->request->root(), 'token' => csrf_token()];
     $view->scripts = $this->assets->scripts();
     $view->styles = $this->assets->styles();
     $view->menu = $this->menuBuilder;
 }
开发者ID:guratr,项目名称:cruddy,代码行数:11,代码来源:LayoutComposer.php

示例2: isPage

 /**
  * Return true if current page is $page.
  */
 public function isPage(string $page, array $parameters = []) : bool
 {
     // Check if $page is a route name
     if ($this->route->has($page)) {
         if ($parameters) {
             return $this->url->current() == $this->url->route($page, $parameters);
         }
         return $this->route->currentRouteName() == $page;
     }
     return str_replace($this->request->root() . '/', '', $this->url->full()) == $page;
 }
开发者ID:atorscho,项目名称:laravel-helpers,代码行数:14,代码来源:Assertions.php

示例3: prependHost

 /**
  * prepend host to url path
  *
  * @param string $url url path
  * @return string
  */
 protected function prependHost($url)
 {
     if (preg_match('/^(http[s]?\\:\\/\\/)([^\\/]+)/i', $url, $matches) === 0) {
         return $this->request->root() . '/' . ltrim($url, '/');
     }
     return $url;
 }
开发者ID:pokev25,项目名称:xpressengine,代码行数:13,代码来源:AbstractImporter.php

示例4: track

 /**
  * Track clicked links and form submissions.
  *
  * @param  Request $request
  * @return void
  */
 public function track(Request $request)
 {
     // Don't track if there is no active experiment.
     if (!$this->session->get('experiment')) {
         return;
     }
     // Since there is an ongoing experiment, increase the pageviews.
     // This will only be incremented once during the whole experiment.
     $this->pageview();
     // Check current and previous urls.
     $root = $request->root();
     $from = ltrim(str_replace($root, '', $request->headers->get('referer')), '/');
     $to = ltrim(str_replace($root, '', $request->getPathInfo()), '/');
     // Don't track refreshes.
     if ($from == $to) {
         return;
     }
     // Because the visitor is viewing a new page, trigger engagement.
     // This will only be incremented once during the whole experiment.
     $this->interact();
     $goals = $this->getGoals();
     // Detect goal completion based on the current url.
     if (in_array($to, $goals) or in_array('/' . $to, $goals)) {
         $this->complete($to);
     }
     // Detect goal completion based on the current route name.
     if ($route = Route::currentRouteName() and in_array($route, $goals)) {
         $this->complete($route);
     }
 }
开发者ID:Raphael-C-Almeida,项目名称:laravel-5-ab,代码行数:36,代码来源:Tester.php

示例5: getRootUrl

 /**
  * Get the base URL for the request.
  *
  * @param  string  $scheme
  * @param  string  $root
  * @return string
  */
 protected function getRootUrl($scheme, $root = null)
 {
     if (is_null($root)) {
         $root = $this->forcedRoot ?: $this->request->root();
     }
     $start = starts_with($root, 'http://') ? 'http://' : 'https://';
     return preg_replace('~' . $start . '~', $scheme, $root, 1);
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:15,代码来源:UrlGenerator.php

示例6: store

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $ticket['amountDue'] = intval($request->input('tickets') * 55);
     $ticket['tickets'] = intval($request->input('tickets'));
     $ticket['payment'] = $request->input('payment');
     $ticket['name'] = ucwords(strtolower($request->input('name')));
     $ticket['email'] = $request->input('email');
     $ticket['phone'] = $request->input('phone');
     $ticket['dni'] = $request->input('dni');
     $ticket['comments'] = empty($request->input('comments')) ? "El usuario no ha dejado ningún comentario." : $request->input('comments');
     $ticket['status'] = false;
     $ticketParseObject = $this->tickets->create($ticket);
     if (strcmp($request->input('payment'), 'paypal') == 0) {
         $request->session()->put('objectId', $ticketParseObject->getObjectId());
         $payer = Paypalpayment::Payer();
         $payer->setPaymentMethod("paypal");
         $tickets = Paypalpayment::item();
         $tickets->setName('Entrada Fiesta Halloween 2015')->setDescription('Entrada Fiesta Halloween 2015')->setCurrency('EUR')->setQuantity(intval($request->input('tickets')))->setPrice(55.0);
         $itemList = Paypalpayment::itemList();
         $itemList->setItems(array($tickets));
         $amount = Paypalpayment::Amount();
         $amount->setCurrency("EUR")->setTotal(intval($request->input('tickets') * 55));
         $transaction = Paypalpayment::Transaction();
         $transaction->setAmount($amount)->setItemList($itemList)->setDescription("Entrada Fiesta Halloween 2015")->setInvoiceNumber(uniqid());
         $baseUrl = $request->root();
         $redirectUrls = Paypalpayment::RedirectUrls();
         $redirectUrls->setReturnUrl($baseUrl . '/tickets-payment/confirmpayment')->setCancelUrl($baseUrl . '/tickets-payment/cancelpayment');
         $payment = Paypalpayment::Payment();
         $payment->setIntent("sale");
         $payment->setPayer($payer);
         $payment->setRedirectUrls($redirectUrls);
         $payment->setTransactions(array($transaction));
         $response = $payment->create($this->_apiContext);
         //set the trasaction id , make sure $_paymentId var is set within your class
         $this->_paymentId = $response->id;
         //dump the repose data when create the payment
         $redirectUrl = $response->links[1]->href;
         //this is will take you to complete your payment on paypal
         //when you confirm your payment it will redirect you back to the rturned url set above
         //inmycase sitename/payment/confirmpayment this will execute the getConfirmpayment function bellow
         //the return url will content a PayerID var
         return redirect()->to($redirectUrl);
     } else {
         $email = $ticket['email'];
         $name = $ticket['name'];
         \Mail::send('emails.wire-transfer', $ticket, function ($msg) use($email, $name) {
             $msg->to($email, $name);
             $msg->from('info@breakingbind.com', 'Breaking Bind')->subject('¡Tu compra ha sido procesada correctamente!');
         });
         \Mail::send('emails.notification', $ticket, function ($msg) use($email, $name) {
             $msg->from($email, $name);
             $msg->to('info@breakingbind.com', 'Breaking Bind')->subject('Nueva compra de entradas para la fiesta de Halloween 2015 [TRANSFERENCIA BANCARIA]');
         });
         flash()->overlay('Tu compra ha sido procesada correctamente!', 'Por favor, revisa tu correo electronico ' . $email . ' y sigue las instrucciones para realizar el pago de las entradas.');
         return redirect('/');
     }
 }
开发者ID:raffe90,项目名称:breakingbind,代码行数:62,代码来源:TicketsPaymentController.php

示例7: __construct

 /**
  * Construct a new instance.
  *
  * @param  string  $handles
  * @param  \Illuminate\Http\Request  $request
  */
 public function __construct($handles, Request $request)
 {
     $this->request = $request;
     $this->setBaseUrl($this->request->root());
     // If the handles doesn't start as "//some.domain.com/foo" we should
     // assume that it doesn't belong to any subdomain, otherwise we
     // need to split the value to "some.domain.com" and "foo".
     if (is_null($handles) || !Str::startsWith($handles, ['//', 'http://', 'https://'])) {
         $this->prefix = $handles;
     } else {
         $handles = substr(str_replace(['http://', 'https://'], '//', $handles), 2);
         $fragments = explode('/', $handles, 2);
         $this->domain = array_shift($fragments);
         $this->prefix = array_shift($fragments);
     }
     // It is possible that prefix would be null, in this case assume
     // it handle the main path under the domain.
     !is_null($this->prefix) || ($this->prefix = '/');
 }
开发者ID:jitheshgopan,项目名称:extension,代码行数:25,代码来源:RouteGenerator.php

示例8: createLinkUp

 /**
  * Creates a Link which points to a URL up $steps times from the current URL
  *
  * @param string $rel   Name of the Rel of the Link
  * @param int $steps    Steps to go up in the URL
  * @return array
  */
 public function createLinkUp($rel, $steps = 1)
 {
     $uriParts = explode("/", ltrim($this->request->path()));
     $count = 0;
     while ($count < $steps) {
         array_pop($uriParts);
         $count++;
     }
     return $this->createLink($rel, $this->request->root() . '/' . implode('/', $uriParts));
 }
开发者ID:noherczeg,项目名称:restext,代码行数:17,代码来源:RestLinker.php

示例9: shorten

 public function shorten(Request $request)
 {
     $longUrl = parse_url($request->url, PHP_URL_SCHEME) ? $request->url : 'http://' . $request->url;
     if (filter_var($longUrl, FILTER_VALIDATE_URL) === false) {
         return view('pages.url.index', ['error' => 'Unable to shorten that link. It is not a valid url.']);
     }
     $url = Url::where('long_url', '=', $longUrl)->first();
     if ($url == null) {
         $ln = 2;
         $generatedToken = null;
         while ($generatedToken == null && $ln < 10) {
             $tempToken = $this->generateToken($ln);
             $url = Url::where('token', '=', $tempToken)->first();
             if ($url == null) {
                 $generatedToken = $tempToken;
             } else {
                 $ln++;
             }
         }
         if ($generatedToken != null) {
             $url = new Url();
             $url->token = $generatedToken;
             $url->long_url = $longUrl;
             $url->save();
             $success['token'] = $url->token;
             $success['long_url'] = $url->long_url;
             $success['short_url'] = preg_replace('#(http|https|ftp)://(www\\.?)?#i', '', $request->root()) . '/' . $url->token;
             $success['filtered_url'] = preg_replace('#(http|https|ftp)://(www\\.?)?#i', '', $url->long_url);
         } else {
             $error = 'Something went wrong and it\'s my fault. Please try again.';
             return view('pages.url.index', ['error' => $error]);
         }
     } else {
         $success['token'] = $url->token;
         $success['long_url'] = $url->long_url;
         $success['short_url'] = preg_replace('#(http|https|ftp)://(www\\.?)?#i', '', $request->root()) . '/' . $url->token;
         $success['filtered_url'] = preg_replace('#(http|https|ftp)://(www\\.?)?#i', '', $url->long_url);
     }
     //return redirect()->route('pages.url.index');
     return view('pages.url.index', ['success' => $success]);
 }
开发者ID:chozzz,项目名称:vurl,代码行数:41,代码来源:UrlController.php

示例10: show

 public function show(Request $request)
 {
     $key = md5(str_replace($request->root(), '', $request->fullUrl()) . $request->header('User-Agent'));
     if (\Cache::has($key)) {
         $content = \Cache::get($key);
     } else {
         $originCssRootUri = env('ORIGIN_CSS_ROOT_URI');
         $originCssUri = str_replace($request->root() . '/', $originCssRootUri, $request->fullUrl());
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $originCssUri);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_USERAGENT, $request->header('User-Agent'));
         $originContent = curl_exec($ch);
         curl_close($ch);
         $originFontRootUri = env('ORIGIN_FONT_ROOT_URI');
         $cdnFontRootUri = env('CDN_FONT_ROOT_URI');
         $content = str_replace($originFontRootUri, $cdnFontRootUri, $originContent);
         \Cache::put($key, $content, 1440);
     }
     return response($content)->header('Content-Type', 'text/css')->header('Cache-Control', 'public, max-age=86400');
 }
开发者ID:sinkcup,项目名称:gmirror-fonts,代码行数:21,代码来源:Css.php

示例11: findLocation

 protected function findLocation(Request $request, $filename)
 {
     $root = $request->root();
     $infix = '/static/';
     $localStorage = '/web-storage/clipshare';
     do {
         $randomString = str_random(8);
         $local = $localStorage . $infix . $randomString . '/';
     } while (File::exists($local));
     $url = $root . $infix . $randomString . '/' . $filename;
     return ['folder' => $local, 'url' => $url, 'local' => $local . $filename];
 }
开发者ID:Gladdy,项目名称:clipshare-old,代码行数:12,代码来源:ContentController.php

示例12: getRequestToken

 /**
  * Gets the request token from the Pocket API
  * @param  Request $request
  * @return json           The JSON response from the Pocket API
  */
 public function getRequestToken(Request $request)
 {
     $redirect_uri = $request->root() . '/auth/callback';
     $response = $this->sendApiRequest('oauth/request', ['redirect_uri' => $redirect_uri]);
     if ($this->isErrorResponse($response)) {
         return view('error')->withErrorMessage($response->content());
     }
     $request_token = json_decode($response->getContent())->code;
     $request->session()->put('request_token', $request_token);
     $query_vars = ['request_token' => $request_token, 'redirect_uri' => $redirect_uri];
     return response()->json(['redirect_to' => 'https://getpocket.com/auth/authorize?' . http_build_query($query_vars)]);
 }
开发者ID:jaden,项目名称:HotPocket,代码行数:17,代码来源:ItemController.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $uri_segments = $request->segments();
     $subdominio = $request->root();
     $subdominio = str_replace('http://', '', $subdominio);
     $subdominio = explode('.', $subdominio);
     $subdominio = $subdominio['0'];
     if ($subdominio === "api") {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
开发者ID:AndresRojasIsaza,项目名称:Delivery,代码行数:19,代码来源:VerifyCsrfToken.php

示例14: sitemapPages

 public function sitemapPages(Request $request)
 {
     $sitemap_pages = \App::make("sitemap");
     $domain = str_replace('http://', '', $request->root());
     // set cache
     $sitemap_pages->setCache('__sitemap_pages__', 3600);
     $sitemap_pages->add(route('homepage', [$domain]), null, '1', 'weekly');
     $sitemap_pages->add(route('authGetLogin'), null, '1', 'weekly');
     $sitemap_pages->add(route('authGetSignup'), null, '1', 'weekly');
     $sitemap_pages->add(route('CustomerTrackingOrder', [$domain]), null, '1', 'weekly');
     return $sitemap_pages->render('xml');
 }
开发者ID:kacana,项目名称:kacana.com,代码行数:12,代码来源:SitemapController.php

示例15: show

 public function show(Request $request)
 {
     $uri = str_replace($request->root(), 'http://fonts.googleapis.com/', $request->fullUrl());
     if (\Cache::has('css')) {
         $content = \Cache::get('css');
     } else {
         $originalContent = file_get_contents($uri);
         $content = str_replace('http://fonts.gstatic.com/', 'http://fonts-gstatic-com.gmirror.org/', $originalContent);
         \Cache::put('css', $content, 1440);
     }
     return response($content)->header('Content-Type', 'text/css')->header('Cache-Control', 'public, max-age=86400');
 }
开发者ID:HuangWenhuan0,项目名称:gmirror-fonts,代码行数:12,代码来源:Css.php


注:本文中的Illuminate\Http\Request::root方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。