本文整理汇总了PHP中LaravelLocalization::getLocalizedURL方法的典型用法代码示例。如果您正苦于以下问题:PHP LaravelLocalization::getLocalizedURL方法的具体用法?PHP LaravelLocalization::getLocalizedURL怎么用?PHP LaravelLocalization::getLocalizedURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LaravelLocalization
的用法示例。
在下文中一共展示了LaravelLocalization::getLocalizedURL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: geturl
function geturl($url, $attributes = array())
{
if (!$url) {
$url = '/';
}
return LaravelLocalization::getLocalizedURL(App::getLocale(), $url, $attributes);
}
示例2: datatable
public function datatable()
{
$pages = $this->model->select('*');
return Datatables::of($pages)->addColumn('action', function ($p) {
return '<a target="_blanc" href="' . LaravelLocalization::getLocalizedURL(App::getLocale(), route('front.page', ['slug' => $p->slug])) . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-search"></i> View</a> <a href="' . action('Dashboard\\PagesController@destroy', ['id' => $p->id]) . '" class="btn btn-xs btn-danger"><i class="glyphicon glyphicon-remove"></i> Delete</a>';
})->editColumn('title', function ($p) {
return '<a href="' . action('Dashboard\\PagesController@edit', ['id' => $p->id]) . '">' . $p->title . '</a>';
})->editColumn('created_at', '{!! $created_at->diffForHumans() !!}')->editColumn('updated_at', '{!! $updated_at->diffForHumans() !!}')->make(true);
}
示例3: foreach
<?php
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<?php
$domains = Domain::where('status', 1)->orderBy('updated_at', 'DESC')->get(['id', 'updated_at']);
if ($domains) {
foreach ($domains as $domain) {
$ro_url = LaravelLocalization::getLocalizedURL('ro', Domain::seoURL($domain->id), 'ro');
$en_url = LaravelLocalization::getLocalizedURL('en', Domain::seoURL($domain->id), 'en');
?>
<url>
<loc><?php
echo $ro_url;
?>
</loc>
<xhtml:link rel="alternate" hreflang="ro" href="<?php
echo $ro_url;
?>
" />
<xhtml:link rel="alternate" hreflang="en" href="<?php
echo $en_url;
?>
" />
<priority>1</priority>
<lastmod><?php
echo date('c', strtotime($domain->updated_at));
?>
</lastmod>
示例4: foreach
<?php
foreach (LaravelLocalization::getSupportedLocales() as $localeCode => $properties) {
?>
<li class="<?php
if (Request::segment(1) == $localeCode) {
?>
overwrite <?php
}
?>
">
<a rel="alternate" hreflang="<?php
echo e($localeCode);
?>
" href="<?php
echo e(LaravelLocalization::getLocalizedURL($localeCode));
?>
">
<?php
echo e($properties['native']);
?>
</a>
</li>
<?php
}
?>
</ul>
<ul class="nav navbar-nav center-element">
<li><a href="#about" class="telephone"><span class="glyphicon glyphicon-earphone"></span> 0899991045</a></li>
示例5: geturl
function geturl($url, $locale = false, $attributes = array())
{
if (!$locale) {
$locale = App::getLocale();
}
return LaravelLocalization::getLocalizedURL($locale, $url, $attributes);
}
示例6: function
}]);
Route::post('search', ['as' => 'search.post', 'uses' => 'HomeController@searchAjax']);
Route::get('generate-sitemap', function () {
ini_set('memory_limit', '2048M');
$domains = Domain::where('status', 1)->get(['id', 'updated_at']);
$categories = Category::where('status', 1)->get(['path', 'updated_at']);
$langs = LaravelLocalization::getSupportedLocales();
// create new sitemap object
$sitemap = App::make("sitemap");
// set cache (key (string), duration in minutes
// (Carbon|Datetime|int), turn on/off (boolean))
// by default cache is disabled
//$sitemap->setCache('laravel.sitemap', 3600);
$i = 0;
$ci = 0;
foreach ($domains as $domain) {
$translations = array(array('url' => LaravelLocalization::getLocalizedURL('ro', Domain::seoURL($domain->id), 'ro'), 'language' => 'ro'), array('url' => LaravelLocalization::getLocalizedURL('en', Domain::seoURL($domain->id), 'en'), 'language' => 'en'));
foreach ($langs as $lang_code => $lang_details) {
$sitemap->add(LaravelLocalization::getLocalizedURL($lang_code, Domain::seoURL($domain->id)), date('c', strtotime($domain->updated_at)), 1.0, 'daily', null, null, $translations);
}
$i++;
}
foreach ($categories as $category) {
$ctranslations = array(array('url' => LaravelLocalization::getLocalizedURL('ro', URL::route('category.details', [$category->path]), 'ro'), 'language' => 'ro'), array('url' => LaravelLocalization::getLocalizedURL('en', URL::route('category.details', [$category->path]), 'en'), 'language' => 'en'));
foreach ($langs as $lang_code => $lang_details) {
$sitemap->add(LaravelLocalization::getLocalizedURL($lang_code, URL::route('category.details', [$category->path])), date('c', strtotime($category->updated_at)), 1.0, 'daily', null, null, $ctranslations);
}
$ci++;
}
$r = $sitemap->store('xml');
});
示例7: ma_get_admin_preview_url
/**
* @param $model
* @return mixed
*/
function ma_get_admin_preview_url($model)
{
$modelName = !is_object($model) ? strtolower($model) : strtolower(str_plural(class_basename($model)));
$resourcePath = $modelName != 'articles' ? str_plural($modelName) . '/' . $model->slug : $model->slug;
$path = LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), URL::to($resourcePath));
return URL::to($path);
}