本文整理汇总了PHP中Illuminate\Support\Facades\Request::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::url方法的具体用法?PHP Request::url怎么用?PHP Request::url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
// dd(Page::all()->toArray());
$page = Page::orWhere(function ($query) {
$query->where('url', '=', Request::path());
})->orWhere(function ($query) {
$query->where('url', '=', '/' . Request::path());
})->orWhere(function ($query) {
$query->where('url', '=', Request::url());
})->orWhere(function ($query) {
$query->where('url', '=', Request::route()->getPath());
})->orWhere(function ($query) {
$query->where('url', '=', '/' . Request::route()->getPath());
})->get()->first();
$ps = Post::where('page_id', '=', $page->id)->orderBy('sort', 'ASC')->orderBy('id', 'ASC')->get();
$posts = [];
foreach ($page->template()->first()->sections() as $sec) {
$posts[$sec->name] = [];
}
foreach ($ps as $p) {
$posts[$p->section()->first()->name][] = $p;
}
$pages = [];
foreach (Page::all() as $pi) {
$pages[$pi->name] = $pi;
}
$fn = str_replace('.blade.php', '', $page->template()->first()->filename);
return View::make("aui/templates/" . $fn)->with('posts', $posts)->with('pages', $pages)->with('page', $page);
}
示例2: current
public function current($uri = false)
{
if ($uri) {
return Request::url();
}
return Request::fullUrl();
}
示例3: get
public function get($breadcrumbs_data)
{
$bakery_data = [];
foreach ($breadcrumbs_data as $route => $link_text) {
$obj = new \stdClass();
if ($route == '*') {
$obj->url = Request::url();
$obj->isCurrent = true;
} else {
$params = [];
if (strpos($route, ':') !== false) {
list($route, $params) = explode(':', $route);
if (strpos($params, ',') !== false) {
$params = explode(',', $params);
} else {
$params = [$params];
}
}
$obj->url = route($route, $params);
$obj->isCurrent = false;
}
$obj->title = $link_text;
$bakery_data[] = $obj;
}
return $bakery_data;
}
示例4: buildSiteMap
/**
* Build the Site Map
*/
protected function buildSiteMap()
{
$postsInfo = $this->getPostsInfo();
$dates = array_values($postsInfo);
sort($dates);
$lastmod = last($dates);
$url = str_finish(Request::url(), '/');
$xml = [];
$xml[] = '<?xml version="1.0" encoding="UTF-8"?' . '>';
$xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$xml[] = ' <url>';
$xml[] = " <loc>{$url}</loc>";
$xml[] = " <lastmod>11.1.1982</lastmod>";
$xml[] = ' <changefreq>daily</changefreq>';
$xml[] = ' <priority>0.8</priority>';
$xml[] = ' </url>';
foreach ($postsInfo as $slug => $lastmod) {
$xml[] = ' <url>';
$xml[] = " <loc>{$url}haberci/{$slug}</loc>";
$xml[] = " <lastmod>11</lastmod>";
$xml[] = " </url>";
}
$xml[] = '</urlset>';
return join("\n", $xml);
}
示例5: put
public function put(Route $route, Request $request, Response $response)
{
$key = $this->makeCacheKey($request->url());
if (!Cache::has($key)) {
Cache::put($key, $response->getContent(), 60);
}
}
示例6: redirect
/**
* Redirect user to login using OAuth credentials.
*
* @return Illuminate\Support\Facades\Redirect $forward_url
*/
public function redirect()
{
$comToken = $this->getNewComToken();
Session::put('ComToken', $comToken);
$callback = Request::url();
$forward_url = $this->loginURL . "?ComToken=" . $comToken . "&callback_url=" . urlencode($callback);
return Redirect::to($forward_url);
}
示例7: reportException
/**
* Report an exception.
*
* @param Exception $exception
*/
public function reportException(Exception $exception)
{
try {
$attributes = ['user_id' => $this->getUserId(), 'class' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTraceAsString(), 'url' => Request::url(), 'ip' => $this->getIpAddress(), 'user_agent' => $this->getUserAgent(), 'created_at' => Carbon::now()];
$this->getRepository()->insert($attributes);
event(new ExceptionWasReported($exception));
} catch (Exception $e) {
}
}
示例8: onRun
public function onRun()
{
$settings = Settings::instance();
$this->addCss('/plugins/hariadi/share/assets/css/share.css');
foreach ($this->providers as $provider) {
$this->page[$provider] = $settings->{$provider};
}
$this->page['url'] = Request::url();
}
示例9: link
private function link($column, $text, $direction)
{
$params = $this->_appends + [$this->_keys['order'] => $column, $this->_keys['direction'] => $direction];
if (Request::has($this->_keys['order']) && Request::input($this->_keys['order']) == $column && Request::input($this->_keys['direction']) == $direction) {
return $text;
}
if (empty($this->_url)) {
$this->_url = Request::url();
}
return '<a href="' . $this->_url . '?' . http_build_query($params) . '">' . $text . '</a>';
}
示例10: _trackException
/**
* @param Exception $e
*/
private function _trackException(Exception $e)
{
$list = Config::get('track.emails', []);
if (count($list) !== 0) {
Mail::send('emails.exception', array('url' => Request::url(), 'exception' => $e->getMessage()), function ($message) use($e, $list) {
foreach ($list as $email) {
$message->to($email, '')->subject(Config::get('app.name') . ': Error ' . $e->getCode());
}
});
}
}
示例11: getCount
public function getCount()
{
$count = $this->getCache();
if (!is_null($count)) {
return $count;
}
$url = 'https://api.tumblr.com/v2/share/stats?url=' . urlencode($this->getOption('url', Request::url()));
$result = $this->fileGetContents($url);
$count = isset($matches['response']['note_count']) ? $matches['response']['note_count'] : 0;
$this->setCache($count);
return $count;
}
示例12: save
public static function save()
{
$self = strtok(Request::server('REQUEST_URI'), '?');
$page = self::all();
$page["back_post"] = Input::all();
$page["back_url"] = Request::url();
Session::put('rapyd.' . $self, $page);
//var_export(Session::all());
//echo "\n\n..";
//var_export(Session::get('rapyd.'.$self.".back_post".".nome"));
//die;
}
示例13: getSharedCount
public function getSharedCount($url = '')
{
if (!$url) {
$url = Request::url();
}
$link = 'https://api.facebook.com/method/links.getStats?format=json&urls=' . urlencode($url);
$data = file_get_contents($link);
$data = json_decode($data);
// share_count
$count = is_array($data) ? $data[0]->total_count : $data->total_count;
return intval($count);
}
示例14: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::check() === false) {
Auth::logout();
Session::put('return_url', Request::url());
return redirect()->to('/admin-login');
}
if (Auth::user()->hasRole('admin') === false) {
return (new Logout())->getLogout();
}
return $next($request);
}
示例15: getCount
public function getCount()
{
$count = $this->getCache();
if (!is_null($count)) {
return $count;
}
$url = 'https://vk.com/share.php?act=count&index=1&url=' . urlencode($this->getOption('url', Request::url()));
$result = $this->fileGetContents($url);
preg_match('~VK\\.Share\\.count\\(\\d+,\\s*(\\d+)\\);~', $result, $matches);
$count = isset($matches[1]) ? $matches[1] : 0;
$this->setCache($count);
return $count;
}