本文整理汇总了PHP中Illuminate\Http\Request::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getRequestUri方法的具体用法?PHP Request::getRequestUri怎么用?PHP Request::getRequestUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::getRequestUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->secure() && !str_contains($request->getRequestUri(), '/podcasts/rss')) {
return redirect()->secure($request->getRequestUri(), 301);
}
return $next($request);
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (preg_match('/.+\\/$/', $request->getRequestUri())) {
return Redirect::to(rtrim($request->getRequestUri()), 301);
}
return $next($request);
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure() and env('SECURE_COOKIE', false)) {
if (strpos($request->getRequestUri(), '/storage/') === false) {
return redirect()->secure($request->getRequestUri());
}
}
return $next($request);
}
示例4: matches
/**
* Validate a given rule against a route and request.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function matches(Route $route, Request $request)
{
$regex = $route->getCompiled()->getRegex();
if (str_contains($request->getRequestUri(), '/wp-admin')) {
return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
}
$path = $request->path() == '/' ? '/' : '/' . $request->path();
return preg_match($regex, rawurldecode($path));
}
示例5: appendDisqusScript
/**
* Append disqus script on the end of the page.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Response $response
* @return mixed
*/
protected function appendDisqusScript($request, $response)
{
$content = $response->getContent();
if (!Str::contains($content, '<div id="disqus_thread"></div>')) {
return;
}
$uri = $request->getRequestUri();
$pageUrl = url($uri);
$pageId = 'route' . implode('.', explode('/', $uri));
$username = config('disqus.username');
$disqusHtml = <<<CDATA
<script>
var disqus_config = function () {
this.page.url = '{$pageUrl}';
this.page.identifier = '{$pageId}';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//{$username}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href=\\"https://disqus.com/?ref_noscript\\" rel=\\"nofollow\\">comments powered by Disqus.</a></noscript>
CDATA;
$bodyPosition = strripos($content, '</body>');
if (false !== $bodyPosition) {
$content = substr($content, 0, $bodyPosition) . $disqusHtml . substr($content, $bodyPosition);
}
$response->setContent($content);
}
示例6: decopaper
public function decopaper(Request $request)
{
$productType = $this->getProductType($request->getRequestUri());
$model = Category::getType($productType);
$data = ['data' => $model, 'config' => ['route' => '/decopaper', 'header' => 'Decopapers'], 'title' => 'Decopapers at Dakrush Enterprises'];
return view('product_display.list', $data);
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (extension_loaded('newrelic')) {
newrelic_name_transaction(sprintf('%s (%s)', $request->getRequestUri(), $request->method()));
}
return $next($request);
}
示例8: findAllPaginate
/**
* @param Request $request
* @param int $itemsPage
*
* @return mixed
*/
public function findAllPaginate(Request $request, $itemsPage = 30)
{
$key = md5($itemsPage . $request->getRequestUri());
$queryParser = new ParserRequest($request, $this->getModel());
$queryBuilder = $queryParser->parser();
return $this->cacheQueryBuilder($key, $queryBuilder, 'paginate', $itemsPage);
}
示例9: handle
/**
* Redirects any non-secure requests to their secure counterparts.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return redirects to the secure counterpart of the requested uri.
*/
public function handle($request, Closure $next)
{
if (!$request->secure() && app()->environment('production')) {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
示例10: findAllPaginate
/**
* @param Request $request
* @param int $itemsPage
* @return mixed
*/
public function findAllPaginate(Request $request, $itemsPage = 30)
{
$key = sprintf('variation_paginate_%s_%s', $itemsPage, $request->getRequestUri());
$queryParser = ParserRequestFactory::createParser($request, $this->getModel(), $query);
$queryBuilder = $queryParser->parser();
return $this->cacheQueryBuilder($key, $queryBuilder, 'paginate', $itemsPage);
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
//Auth::loginUsingId(47,true);
//dc($guard);
//dc(Auth::user());
if (Auth::guard($guard)->guest()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
//dd('Authenticate, redirect guest login');
//return "view";
return redirect()->guest('login');
}
} elseif ($request->is('backStage/*')) {
if (Auth::user()->isFrontEndUser()) {
$test = 'Authenticate MIDDLEWARE: unauthorized action: ' . $request->getRequestUri() . ', ' . $request->user()->name . ' must be \'back-end user\'';
return response()->view("errors.401", compact('test'), 401);
}
//dc('backStage/*');
//dc($request->user()->isBackEndUser());
//dc(Auth::user()->isBackEndUser());
}
//dc('asdf');
//if (Auth::check())
//dc(Auth::check());
// dc($guard);
//dc(Auth::user());
//dd((Auth::guard($guard)->guest()));
// if (Auth::user()->hasRole('mijnZD-user')){
// return redirect('/dashboard');
//return redirect()->route('sitemap.indexDashboard');
// }
//dd($request);
return $next($request);
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->secure() && env('APP_ENV') === 'prod') {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param Closure $next
*
* @return \Illuminate\Http\RedirectResponse
*/
public function handle($request, Closure $next)
{
if (env('APP_HTTPS') && !env('APP_DEBUG') && !$request->secure()) {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}
示例14: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (strpos($request->getRequestUri(), 'queue') >= 0) {
return $next($request);
}
return parent::handle($request, $next);
}
示例15: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->secure()) {
return redirect()->secure($request->getRequestUri());
}
return $next($request);
}