本文整理匯總了PHP中Illuminate\Http\Request::fullUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::fullUrl方法的具體用法?PHP Request::fullUrl怎麽用?PHP Request::fullUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::fullUrl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getList
public function getList(Request $request, $table = '')
{
if (!$table) {
App::abort(404);
}
\Session::put('backlink', $request->fullUrl());
$orderBy = $request->get('by', 'id');
$orderType = $request->get('type', 'ASC');
$take = $request->has('take') ? $request->get('take') : Config::get('scaffenger.config.rpp');
$filter = $request->has('filter') ? $request->get('filter') : null;
$config = Config::get('scaffenger.tables.' . $table);
$model = $config['model'];
$objects = new $model();
if ($filter) {
//TODO: Search in related tables also
$search_in = [];
foreach ($config['columns'] as $column => $search_field) {
if (in_array($search_field['type'], ['slug', 'text', 'textarea', 'wysiwyg', 'email', 'select'])) {
$search_in[$column] = $search_field;
}
}
$objects = $objects->where(function ($query) use($search_in, $filter) {
foreach ($search_in as $search_field => $field_data) {
$query->orWhere($search_field, 'LIKE', '%' . $filter . '%');
}
});
}
$objects = $objects->orderBy($orderBy, $orderType)->paginate($take);
$objects->setPath(Config::get('app.url') . '/admin/list/' . $table);
return view('scaffenger::list')->with('table', $table)->with('model', $model)->with('config', $config)->with('objects', $objects);
}
示例2: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::user() && !Auth::user()->profile && $request->fullUrl() != action('SettingsProfileController@getIndex', [Auth::user()->username]) && $request->fullUrl() != action('SettingsProfileController@putUpdateProfile', [Auth::user()->username])) {
return redirect()->action('SettingsProfileController@getIndex', [Auth::user()->username]);
}
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->is("sitemap") && $request->fullUrl() != '' && $this->auth->guest()) {
$aSiteMap = \Cache::get('sitemap', []);
$changefreq = 'always';
if (!empty($aSiteMap[$request->fullUrl()]['added'])) {
$aDateDiff = Carbon::createFromTimestamp($aSiteMap[$request->fullUrl()]['added'])->diff(Carbon::now());
if ($aDateDiff->y > 0) {
$changefreq = 'yearly';
} else {
if ($aDateDiff->m > 0) {
$changefreq = 'monthly';
} else {
if ($aDateDiff->d > 6) {
$changefreq = 'weekly';
} else {
if ($aDateDiff->d > 0 && $aDateDiff->d < 7) {
$changefreq = 'daily';
} else {
if ($aDateDiff->h > 0) {
$changefreq = 'hourly';
} else {
$changefreq = 'always';
}
}
}
}
}
}
$aSiteMap[$request->fullUrl()] = ['added' => time(), 'lastmod' => Carbon::now()->toIso8601String(), 'priority' => 1 - substr_count($request->getPathInfo(), '/') / 10, 'changefreq' => $changefreq];
\Cache::put('sitemap', $aSiteMap, 2880);
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->isMethod('get') && !$request->has('PageSpeed') && !$request->is(config('site.admin_path') . '*') && !$request->is('avatar/*') && !$request->is('my/*') && !$request->is('*/login') && !$request->is('*/authorize') && !in_array($request->path(), ['sitemap.xml', 'logout', 'login'])) {
$aSiteMap = Cache::get('sitemap', []);
$changefreq = 'always';
if (!empty($aSiteMap[$request->fullUrl()]['added'])) {
$aDateDiff = Carbon::createFromTimestamp($aSiteMap[$request->fullUrl()]['added'])->diff(Carbon::now());
if ($aDateDiff->y > 0) {
$changefreq = 'yearly';
} else {
if ($aDateDiff->m > 0) {
$changefreq = 'monthly';
} else {
if ($aDateDiff->d > 6) {
$changefreq = 'weekly';
} else {
if ($aDateDiff->d > 0 && $aDateDiff->d < 7) {
$changefreq = 'daily';
} else {
if ($aDateDiff->h > 0) {
$changefreq = 'hourly';
} else {
$changefreq = 'always';
}
}
}
}
}
}
$aSiteMap[$request->fullUrl()] = ['added' => time(), 'lastmod' => Carbon::now()->format('Y-m-d\\TH:i:sP'), 'priority' => 1 - substr_count($request->getPathInfo(), '/') / 10, 'changefreq' => $changefreq];
Cache::forever('sitemap', $aSiteMap);
}
return $next($request);
}
示例5: test
public function test(Request $request)
{
$access_token = \Wechat::getWebAuthAccessToken();
$timestamp = Carbon::now()->getTimestamp();
$addr_sign = ['accesstoken=' . $access_token, 'appid=' . \Wechat::getAppId(), 'noncestr=123456', 'timestamp=' . $timestamp, 'url=' . $request->fullUrl()];
sort($addr_sign);
$addr_sign = implode('&', $addr_sign);
return view('shop.test')->with(['appId' => env('WX_APPID'), 'timestamp' => $timestamp, 'addrSign' => sha1($addr_sign), 'url' => $request->fullUrl(), 'js' => \Wechat::getJssdkConfig(['checkJsApi', 'editAddress', 'openAddress', 'chooseWXPay', 'getLatestAddress', 'openCard', 'getLocation'])]);
// return view('backend.article.customer_index')->with([
// 'items' => Article::paginate(10)
// ]);
}
示例6: getMetaData
/**
* Get the request formatted as meta data.
*
* @return array
*/
public function getMetaData()
{
$data = [];
$data['url'] = $this->request->fullUrl();
$data['httpMethod'] = $this->request->getMethod();
$data['params'] = $this->request->input();
$data['clientIp'] = $this->request->getClientIp();
if ($agent = $this->request->header('User-Agent')) {
$data['userAgent'] = $agent;
}
if ($headers = $this->request->headers->all()) {
$data['headers'] = $headers;
}
return ['request' => $data];
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$currentLocale = app('laravellocalization')->getCurrentLocale();
$defaultLocale = app('laravellocalization')->getDefaultLocale();
$params = explode('/', $request->path());
if (count($params) > 0) {
$localeCode = $params[0];
$locales = app('laravellocalization')->getSupportedLocales();
$hideDefaultLocale = app('laravellocalization')->hideDefaultLocaleInURL();
$redirection = false;
if (!empty($locales[$localeCode])) {
if ($localeCode === $defaultLocale && $hideDefaultLocale) {
$redirection = app('laravellocalization')->getNonLocalizedURL();
}
} else {
if ($currentLocale !== $defaultLocale || !$hideDefaultLocale) {
// If the current url does not contain any locale
// The system redirect the user to the very same url "localized"
// we use the current locale to redirect him
$redirection = app('laravellocalization')->getLocalizedURL(session('locale'), $request->fullUrl());
}
}
if ($redirection) {
// Save any flashed data for redirect
app('session')->reflash();
return new RedirectResponse($redirection, 302, ['Vary' => 'Accept-Language']);
}
}
return $next($request);
}
示例8: paymentMethod
/**
* Dispatch different pay method.
*
* @param Request $request
*/
public function paymentMethod(Request $request)
{
/*
* Switch the paymentMethod from the request, if it match any of
* known methods, it will bind the service interface
* to the concrete service, and controller
* will excute that concrete service
*/
$paymentMethod = null;
if ($request->has('paymentMethod')) {
$paymentMethod = $request->paymentMethod;
} elseif (str_contains($request->fullUrl(), 'alipay')) {
// Here handle the notify_url and return_url
$paymentMethod = 'alipay';
}
if ($paymentMethod != null) {
switch ($paymentMethod) {
case 'alipay':
$this->app->bind('App\\Services\\Payment\\PaymentServiceInterface', 'App\\Services\\Payment\\AlipayService');
break;
default:
// FIXME: For default situation, should not bind alipay
$this->app->bind('App\\Services\\Payment\\PaymentServiceInterface', 'App\\Services\\Payment\\AlipayService');
break;
}
}
}
示例9: getFullUri
/**
* Get full uri but remove switch_locale_to if it's present.
*
* @param string $uri
* @return string
*/
protected function getFullUri()
{
if (!$this->request->switch_locale_to) {
return $this->request->fullUrl();
}
return preg_replace('/(\\?|&)switch_locale_to=.+?(?:(?!&).)/', '', $this->request->fullUrl());
}
示例10: getCurrentHash
/**
* Gets the view hash
*
* @return string
*/
protected function getCurrentHash()
{
if ($this->currentHash === null) {
$this->currentHash = md5($this->request->fullUrl() . $this->request->method() . $this->request->getClientIp());
}
return $this->currentHash;
}
示例11: generate
/**
* Generate and render the HTML metadata tags.
*
* @return string
*/
public function generate()
{
$title = $this->getTitle();
$description = $this->getDescription();
$keywords = $this->getKeywords();
$miscellaneous = $this->getMiscellaneous();
$canonical = $this->getCanonical();
$html[] = '<title>' . $title . '</title>' . PHP_EOL;
if (!is_null($description)) {
$html[] = '<meta name="description" content="' . $description . '">';
}
if (!is_null($keywords)) {
$html[] = '<meta name="keywords" content="' . $keywords . '">';
}
if (!is_null($miscellaneous)) {
foreach ($miscellaneous as $name => $content) {
$html[] = '<meta name="' . $name . '" content="' . $content . '">';
}
}
if (!is_null($canonical)) {
$currentUrl = $this->request->fullUrl();
if ($canonical != $currentUrl) {
$html[] = PHP_EOL . '<link rel="canonical" href="' . $canonical . '">';
}
}
return implode(PHP_EOL, $html);
}
示例12: index
public function index(Request $request)
{
$widgetClasses = WidgetsFacade::all();
asort($widgetClasses);
$widgets = [];
foreach ($widgetClasses as $widgetClass) {
$widget = new $widgetClass();
$widgets[$widget->getName()] = $widget->getDisplayName();
}
$placeholders = HomeThemeFacade::placeholders();
asort($placeholders);
$placeholderNames = array_keys($placeholders);
$themeWidgets = ThemeWidget::whereIn('placeholder', $placeholderNames)->orderBy('order', 'asc')->orderBy('created_at', 'asc')->get();
$themePlaceholders = [];
foreach ($placeholderNames as $placeholderName) {
$themePlaceholders[$placeholderName] = [];
}
foreach ($themeWidgets as $themeWidget) {
$placeholderName = $themeWidget->placeholder;
$themePlaceholders[$placeholderName][] = $themeWidget;
}
$this->theme->title(trans('pages.admin_widgets_title'));
$this->theme->description(trans('pages.admin_widgets_desc'));
return $this->_list(['widgets' => $widgets, 'placeholders' => $placeholders, 'placeholderNames' => $placeholderNames, 'themePlaceholders' => $themePlaceholders, 'rdr_param' => rdrQueryParam($request->fullUrl())]);
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
Logger::middlewareInfo('@ExampleMiddle begin, request:', ['headers' => $request->headers, 'url' => $request->fullUrl(), 'params' => $request->all()]);
$response = $next($request);
Logger::middlewareInfo('@ExampleMiddle end, response:', ['code' => $response->getStatusCode(), 'content' => $response->getContent()]);
return $response;
}
示例14: handle
/**
* Handle the command.
*
* @param Request $request
*/
public function handle(Request $request)
{
$active = null;
/**
* If the route does not exist,
* i.e. a 404 or 500 handling page.
* Then we don't have anything to do.
*/
if (!($route = $request->route())) {
return;
}
$compiled = $route->getCompiled();
$staticPrefix = $compiled->getStaticPrefix();
$exact = $request->fullUrl();
$partial = $request->getUriForPath($staticPrefix);
/* @var LinkInterface $link */
foreach ($this->links as $link) {
if ($link->getUrl() == $exact) {
$active = $link;
} elseif ($link->getUrl() == $partial) {
$active = $link;
}
}
/**
* If we have an current link determined
* then mark it as such.
*
* @var LinkInterface $active
*/
if ($active) {
$active->setActive(true);
}
}
示例15: render
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof TokenMismatchException && $request->path() == 'admin/login') {
Message::warning(pick_trans('login_csrf_token_failed'));
return redirect($request->fullUrl());
}
return parent::render($request, $e);
}