本文整理汇总了PHP中Illuminate\Support\Facades\URL::current方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::current方法的具体用法?PHP URL::current怎么用?PHP URL::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\URL
的用法示例。
在下文中一共展示了URL::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setData
public function setData()
{
$current_page = $this->getPage(URL::current());
if (Input::all()) {
session()->put("{$this->prefix}.data." . $current_page['alias'], Input::all());
}
}
示例2: loadPageTitle
private function loadPageTitle()
{
$pageTitles = config('forone.nav_titles');
$curRouteName = Route::currentRouteName();
if (array_key_exists($curRouteName, $pageTitles)) {
return $pageTitles[$curRouteName];
} else {
// load menus title
$url = URL::current();
$menus = config('forone.menus');
foreach ($menus as $title => $menu) {
if (array_key_exists('children', $menu) && $menu['children']) {
foreach ($menu['children'] as $childTitle => $child) {
$pageTitle = $this->parseTitle($childTitle, $url, $child['active_uri']);
if ($pageTitle) {
return $pageTitle;
}
}
} else {
$pageTitle = $this->parseTitle($title, $url, $menu['active_uri']);
if ($pageTitle) {
return $pageTitle;
}
}
}
}
return $curRouteName;
}
示例3: sortUrl
public static function sortUrl($columns)
{
$columns = (array) $columns;
$input = Input::get();
$key = Config::get('epi::epi.keys.sort');
$sorters = array();
foreach ($columns as $column) {
$input[$key][$column] = static::getDirection($column);
}
return URL::current() . '?' . http_build_query($input, null, '&');
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
Session::flash('redirectTo', URL::current());
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}
return $next($request);
}
示例5: isActive
/**
* Set the active class to the current opened menu.
*
* @param string|array $route
* @param string $className
* @return string
*/
function isActive($route, $className = 'active')
{
if (is_array($route)) {
return in_array(Route::currentRouteName(), $route) ? $className : '';
}
if (Route::currentRouteName() == $route) {
return $className;
}
if (strpos(URL::current(), $route)) {
return $className;
}
}
示例6: setDefaultsFromFile
/**
* Set the metadata from a file.
*
* @param string $file
*/
public function setDefaultsFromFile($file)
{
$file = new Reader($file);
// Fetch columns
$rows = $file->fetchOne();
$file->setOffset(1);
// Fetch entries and set defaults
$entries = $file->fetchAssoc($rows);
foreach ($entries as $entry) {
if (strpos(URL::current(), $entry['url']) !== false) {
$this->defaults = $entry;
}
}
}
示例7: service
/**
* Return an instance of the requested service.
*
* @param string $provider
* @param string $url
* @param array $scope
*
* @return \OAuth\Common\Service\AbstractService
* @throws \Exception
*/
public function service($provider, $url = null, $scope = null)
{
$info = Config::get('laravel-social::providers.' . strtolower($provider));
if (empty($info) || !is_array($info)) {
throw new Exception('Missing configuration details for Social service: ' . $provider);
}
$client_id = array_get($info, 'client_id');
$client_secret = array_get($info, 'client_secret');
$scope = is_null($scope) ? array_get($info, 'scope') : $scope;
if (empty($client_id) || empty($client_secret)) {
throw new Exception('Missing client id/secret for Social service: ' . $provider);
}
return $this->factory->createService(ucfirst($provider), new Credentials($client_id, $client_secret, $url ?: URL::current()), $this->storage, $scope);
}
示例8: isActive
public function isActive($uri)
{
if (strripos($uri, '|')) {
$uris = explode('|', $uri);
foreach ($uris as $name) {
if (strripos(URL::current(), $name)) {
return 'active';
}
}
} else {
if (strripos(URL::current(), $uri)) {
return 'active';
}
}
return '';
}
示例9: isActive
public function isActive($value)
{
$uri = array_key_exists('uri', $value) ? $value['uri'] : '';
if (!$uri) {
$children = $value['children'];
foreach ($children as $child) {
if (strripos(URL::current(), $child['uri'])) {
return 'active';
}
}
} else {
if (strripos(URL::current(), $uri)) {
return 'active';
}
}
return '';
}
示例10: loadPageTitle
private function loadPageTitle()
{
$menus = config('forone.menus');
foreach ($menus as $title => $menu) {
if (array_key_exists('children', $menu) && $menu['children']) {
foreach ($menu['children'] as $childTitle => $child) {
if (strripos(URL::current(), $child['uri'])) {
return $title;
}
}
} else {
if (strripos(URL::current(), $menu['uri'])) {
return $title;
}
}
}
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
Session::put('pre_login_url', URL::current());
return redirect()->guest('/login');
}
}
if (!$request->user()->active) {
$this->auth->logout();
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('/login');
}
}
return $next($request);
}
示例12: query
/**
* Get the query object to be processed by datatables.
*
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function query()
{
$url = explode("/", URL::current());
$assets = FileAsset::select()->where('category', $url[6]);
return $this->applyScopes($assets);
}
示例13: doEditNode
public function doEditNode()
{
$model = $this->model;
$idNode = Input::get('id');
$current = $model::find($idNode);
$templates = Config::get('jarboe::tree.templates');
$template = Config::get('jarboe::tree.default');
if (isset($templates[$current->template])) {
$template = $templates[$current->template];
}
$options = array('url' => URL::current(), 'def_name' => 'tree.' . $template['node_definition'], 'additional' => array('node' => $idNode, 'current' => $current));
$controller = new JarboeController($options);
$result = $controller->query->updateRow(Input::all());
$model::flushCache();
$item = $model::find($idNode);
$result['html'] = View::make('admin::tree.content_row', compact('item'))->render();
// log action
if (\Config::get('jarboe::log.enabled')) {
$this->event->setAction(Event::ACTION_UPDATE);
$this->event->setEntityTable($item->getTable());
$this->event->setEntityId($item->id);
$this->notifyObserver();
}
return Response::json($result);
}
示例14: isActive
/**
* @param $url
* @return null|string
* Detect if current URL is active and add an "active" class
*/
function isActive($url)
{
return URL::current() == URL::to($url) ? 'active' : null;
}
示例15: fromCurrentUrl
/**
* Generate form hash
* @return string
*/
private function fromCurrentUrl()
{
return $this->hash(URL::current());
}