本文整理汇总了PHP中Illuminate\Http\Request::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::path方法的具体用法?PHP Request::path怎么用?PHP Request::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* This middleware forces the entire application to use SSL. We like that, because it's secure.
*
* Shamelessly copied from: http://stackoverflow.com/questions/28402726/laravel-5-redirect-to-https
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$force = env('FORCE_DOMAIN', null);
if ($force != null && $request->getHttpHost() != $force) {
return redirect()->to(env('APP_URL') . '/' . ($request->path() == '/' ? '' : $request->path()));
}
return $next($request);
}
示例2: guess
/**
* Guess the HREF for the views.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$views = $builder->getViews();
foreach ($views as &$view) {
// Only automate it if not set.
if (!isset($view['attributes']['href'])) {
$view['attributes']['href'] = $this->url->to($this->request->path() . '?' . array_get($view, 'prefix') . 'view=' . $view['slug']);
}
}
$builder->setViews($views);
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param integer $key
* @return mixed
*/
public function handle($request, Closure $next, $key)
{
if (Cache::has($request->path() . '-' . $key)) {
return Cache::get($request->path() . '-' . $key);
}
return $next($request);
}
示例4: handle
/**
* Disable sessions for requests to the acs endpoint
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (strpos($request->path(), 'access-control/') === 0 || $request->path() === 'acs' || $request->path() === 'acs/spark') {
$this->app['config']->set('session.driver', 'array');
}
return $next($request);
}
示例5: handle
/**
* Handle the event.
*/
public function handle()
{
if (!$this->config->get('app.debug') && !$this->session->get(__CLASS__ . 'warned') && $this->request->path() == 'admin/dashboard' && $this->modules->get('anomaly.module.installer')) {
$this->session->set(__CLASS__ . 'warned', true);
$this->messages->error('streams::message.delete_installer');
}
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->check() && \Hash::check($this->auth->user()->getNumber(), $this->auth->user()->getPassword()) && $request->path() != 'my/password' && $request->path() != 'logout') {
return redirect()->route('front.my.password')->with('danger-message', trans('site.You have to change your password'));
}
return $next($request);
}
示例7: getEdit
public function getEdit(Request $request)
{
$id = intval(substr($request->path(), strrpos($request->path(), '/') + 1));
$sample = $this->sample->getById($id);
$producers = $this->producer->getAll();
return view('website.user.samples.edit')->with(['browserTitle' => str_replace('{wildcard}', $sample->generated_number, trans('sample.edit_sample_wildcard')), 'mainArea' => 'samples', 'subArea' => 'edit', 'sample' => $sample, 'producers' => $producers]);
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
//Don't add the header to acs requests
if (strpos($request->path(), 'access-control/') === 0 || $request->path() === 'acs' || $request->path() === 'acs/spark') {
return $next($request);
}
return $next($request)->header('Built-By', 'arthurguy.co.uk');
}
示例9: make
/**
* Make the page breadcrumbs.
*
* @param PageInterface $page
*/
public function make(PageInterface $page)
{
$breadcrumbs = [$page->getTitle() => $this->request->path()];
$this->loadParent($page, $breadcrumbs);
foreach (array_reverse($breadcrumbs) as $key => $url) {
$this->breadcrumbs->add($key, $url);
}
}
示例10: 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));
}
示例11: handle
/**
* Handle the event.
*/
public function handle()
{
if ($this->request->path() == 'admin/login') {
$this->breadcrumbs->add('streams::breadcrumb.login', '#');
}
if ($this->request->path() == 'installer/install') {
$this->breadcrumbs->add('streams::breadcrumb.install', '#');
}
}
示例12: handle
/**
* Verify the incoming request is via an ssl connection unless its on an approved url
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure() && env('FORCE_SECURE', 'true')) {
if (strpos($request->path(), 'access-control/') !== 0 && $request->path() !== 'acs' && $request->path() !== 'acs/spark') {
return redirect()->secure($request->path());
}
}
return $next($request);
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::user()) {
Log::info('Admin user is in ID:' . Auth::user()->id . ', email:' . Auth::user()->email . ', Path:' . $request->path() . ', Env:' . env('HTTP_USER_AGENT', 'unrecognized') . ', Time:' . date('Y-m-d H:i:s', time()));
} else {
Log::info('Guest user is in ' . 'Path:' . $request->path() . ', Env:' . env('HTTP_USER_AGENT', 'unrecognized') . ', Time:' . date('Y-m-d H:i:s', time()));
}
return $next($request);
}
示例14: getUriWithoutLocale
/**
* Return requested uri without locale.
*
* @return string
*/
public function getUriWithoutLocale()
{
$current = $this->getUriLocale();
$default = $this->getDefaultLocale();
$path = $this->request->path();
if ($current == $default) {
return $path;
}
return preg_replace('/' . $current . '\\/?/', '', $path);
}
示例15: handle
/**
* Handle the event.
*/
public function handle()
{
if (in_array($this->request->path(), ['admin/logout'])) {
return;
}
if ($this->request->segment(1) !== 'admin') {
return;
}
$this->template->put('cp', $this->controlPanel->build());
}