当前位置: 首页>>代码示例>>PHP>>正文


PHP LaravelLocalization类代码示例

本文整理汇总了PHP中LaravelLocalization的典型用法代码示例。如果您正苦于以下问题:PHP LaravelLocalization类的具体用法?PHP LaravelLocalization怎么用?PHP LaravelLocalization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LaravelLocalization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     // retrieve all the user_ids from DB
     $users = DB::table('users')->pluck('id');
     // create posts for a single user only
     // $users = ['0'=>'34'];
     //echo '<pre>'; print_r($users); echo '</pre>'; exit;
     // retrieve all the taxon_ids from DB
     $taxons = DB::table('blog_taxons')->pluck('id');
     // the following commneted lines add the same user for each post
     //factory(App\Models\Posts\Post::class, 5)->create([
     //    'user_id' => $faker->randomElement($users)
     //]);
     // the following lines add a diferent user for each post
     foreach (range(1, 5) as $index) {
         //the following lines make use of the model factory
         //$post = factory(App\Models\Posts\Post::class)->create([
         //    'user_id' => $faker->randomElement($users)
         //]);
         $post = App\Models\Posts\Post::create(['title' => ucwords(implode(' ', $faker->words(5))), 'is_public' => $faker->boolean, 'identifier' => $faker->slug, 'post_type' => $faker->word, 'content' => implode(' ', $faker->paragraphs(3)), 'content_data' => implode(' ', $faker->paragraphs(3)), 'draft' => implode(' ', $faker->paragraphs(3)), 'producer_name' => $faker->word, 'youtube_code' => $faker->word, 'copyright_holder' => $faker->word, 'reference_link_target' => $faker->word, 'source_of_supply' => $faker->word, 'user_id' => $faker->randomElement($users)]);
         foreach (LaravelLocalization::getSupportedLocales() as $locale => $data) {
             if ($locale != LaravelLocalization::getCurrentLocale()) {
                 $post->translateOrNew($locale);
                 $post->translate($locale)->title = strtoupper($locale) . '::' . ucwords(implode(' ', $faker->words(5)));
                 //$post->translate($locale)->slug         = $faker->slug;
                 $post->translate($locale)->identifier = $faker->slug;
                 $post->translate($locale)->content = implode(' ', $faker->paragraphs(3));
                 $post->translate($locale)->content_data = implode(' ', $faker->paragraphs(3));
                 $post->translate($locale)->draft = implode(' ', $faker->paragraphs(3));
             }
         }
         $post->save();
         if (count($taxons)) {
             $post->taxons()->attach($faker->randomElement($taxons));
         }
     }
 }
开发者ID:mindeleven,项目名称:bride-of-facetasm-dev,代码行数:43,代码来源:BlogPostTableSeeder.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $inputs = Request::all();
     $reglas = array('nombre' => 'required', 'correo' => 'email', 'comentarios' => 'required|max:300');
     $mensajes = array('required' => trans('error.requerido'), 'email' => trans('error.correo'));
     $validar = Validator::make($inputs, $reglas, $mensajes);
     if ($validar->fails()) {
         //return back('#gracias')->withErrors($validar)->withInput();
         return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '#about')->withErrors($validar)->withInput();
     } else {
         $contacto = new Contacto();
         $contacto->email = Request::get('correo');
         $contacto->save();
         $contactName = Request::get('nombre');
         $contactEmail = Request::get('correo');
         $contactMessage = Request::get('comentarios');
         $contactAddres = Request::get('direccion');
         $data = array('name' => $contactName, 'email' => $contactEmail, 'description' => $contactMessage, 'addres' => $contactAddres);
         Mail::send('layouts.email', $data, function ($message) use($contactEmail, $contactName) {
             $message->from($contactEmail, $contactName);
             $message->to('contacto@fundacionvivemejor.org', 'Contacto Fundacion Vive Mejor')->subject('Solicitud vía WEB');
             $message->cc($contactEmail, $contactName);
         });
         return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '?gracias#gracias');
     }
 }
开发者ID:efrenrz,项目名称:fundacion,代码行数:31,代码来源:ContactoController.php

示例3: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $params = $this->params;
     $localization = \Mcamara\LaravelLocalization\LaravelLocalization::class;
     if (class_exists($localization)) {
         \LaravelLocalization::setLocale($this->locale);
     }
     app()->setLocale($this->locale);
     if ($this->type == 'Normal') {
         // Text send
         Mail::raw($params['html'], function ($message) use($params) {
             if ($params['attach']) {
                 $message->attach($params['attach']);
             }
             $message->to($params['to'])->from(env('MAIL_USERNAME'), $params['fromName'])->subject($params['subject']);
         });
     } elseif ($this->type == 'Template') {
         // Template send
         Mail::send($params['templateInvokeName'], $params['xsmtpapi'], function ($message) use($params) {
             if ($params['attach']) {
                 $message->attach($params['attach']);
             }
             $message->to($params['to'])->from(env('MAIL_USERNAME'), $params['fromName'])->subject($params['subject']);
         });
     }
     $fileDir = $this->getSwiftmailLogDir();
     $this->logInfo('[' . Carbon::now($this->local)->format('Y-m-d H:i:s') . ']' . json_encode($params, JSON_UNESCAPED_UNICODE) . chr(10), $fileDir);
 }
开发者ID:mrvokia,项目名称:mailhub,代码行数:33,代码来源:MailSender.php

示例4: geturl

 function geturl($url, $attributes = array())
 {
     if (!$url) {
         $url = '/';
     }
     return LaravelLocalization::getLocalizedURL(App::getLocale(), $url, $attributes);
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject1,代码行数:7,代码来源:helpers.php

示例5: doChangeLocale

 public function doChangeLocale()
 {
     $locale = Input::get('locale');
     LaravelLocalization::setLocale($locale);
     App::setLocale($locale);
     Cookie::queue('locale', $locale);
     return Response::json(array('status' => true, 'link' => geturl(Input::get('url'))));
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject1,代码行数:8,代码来源:HomeController.php

示例6: 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);
 }
开发者ID:TahiriAbdou,项目名称:FacebookCloud,代码行数:9,代码来源:PagesRepository.php

示例7: getSwitchLocale

 /**
  * @param Request $request
  * @param $locale
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function getSwitchLocale(Request $request, $locale)
 {
     // check if supported
     $supportedLanguagesKeys = \LaravelLocalization::getSupportedLanguagesKeys();
     if (!in_array($locale, $supportedLanguagesKeys)) {
         abort(404);
     }
     // store in session
     session(['someline-locale' => $locale]);
     // check if has redirect url
     $redirect_url = '/';
     if ($request->has('redirect_url')) {
         $redirect_url = $request->get('redirect_url');
     }
     return redirect($redirect_url);
 }
开发者ID:someline,项目名称:starter-framework,代码行数:21,代码来源:LocaleController.php

示例8: seoURL

 public static function seoURL($domain_id, $lang = '')
 {
     $domain = Domain::find($domain_id);
     $clean_chars = function ($string) {
         $string = str_replace(' ', '-', $string);
         // Replaces all spaces with hyphens.
         $string = preg_replace('/[^A-Za-z0-9\\-]/', '', $string);
         // Removes special chars.
         return preg_replace('/-+/', '-', strtolower($string));
         // Replaces multiple hyphens with single one.
     };
     $domain_name = self::formatDiacritics($clean_chars($domain->name));
     if (empty($lang)) {
         $lang = LaravelLocalization::getCurrentLocale();
     }
     return URL::route('domain.details', ['name' => $domain_name, 'id' => $domain->id]);
 }
开发者ID:CalinB,项目名称:web-directory,代码行数:17,代码来源:Domain.php

示例9:

<?php

/*
|--------------------------------------------------------------------------
| Language Settings
|--------------------------------------------------------------------------
*/
$lang = null;
if (App::environment() == 'testing') {
    $lang = 'fr';
}
LaravelLocalization::setLocale($lang);
开发者ID:Houbsi,项目名称:Core,代码行数:12,代码来源:routes.php

示例10: array_except

$__env->startSection('content');
?>

<!-- /#sidebar-wrapper -->

<!-- Page Content -->
<div id="page-content-wrapper">
    <div class="container-fluid">
         <?php 
echo $__env->make('template.lang', array_except(get_defined_vars(), array('__data', '__path')))->render();
?>
 
        <div class="row">
            <div class="col-lg-12">
                <form action="<?php 
echo e(URL::asset(LaravelLocalization::setLocale() . DIRECTORY_SEPARATOR . 'admin-product-add'));
?>
" method="post" enctype="multipart/form-data">
                    
                    <div class="form-group">
                        <label for="usr">Заглавие: </label>
                        <input name="title" type="text" class="form-control" id="usr">
                    </div>
                     <input type="hidden" name="_token" value="<?php 
echo e(csrf_token());
?>
">

                    <div class="form-group">
                        <label for="usr">Кратко описание: </label>
                        <textarea name='summary' class="form-control" rows="3" id="comment"></textarea>
开发者ID:sbrojdenov,项目名称:shop,代码行数:31,代码来源:b053ddb48ba3de8f34a959be72e1453cf84625fc.php.php

示例11: route

        <li><a href="{{ route('dashboard.index') }}"><i class="fa fa-dashboard"></i> {{ trans('core::core.breadcrumb.home') }}</a></li>
        <li><a href="{{ route('admin.site.site.index') }}">{{ trans('site::sites.title.sites') }}</a></li>
        <li class="active">{{ trans("site::sites.title.$operation site") }}</li>
    </ol>
@stop

@section('styles')
    {!! Theme::script('js/vendor/ckeditor/ckeditor.js') !!}
    {!! Theme::style('css/vendor/iCheck/flat/blue.css') !!}
@stop

@section('content')

    <?php 
if (!isset($supportedLocales)) {
    $supportedLocales = LaravelLocalization::getSupportedLocales();
}
if (!isset($activeLocale)) {
    $allLocales = array_keys($supportedLocales);
    $activeLocale = $allLocales[0];
}
?>

    {!! Form::open(['route' => ["admin.site.site.$route", $model->id], 'method' => "$method"]) !!}
    <div class="row">
        <div class="col-md-12">

            <div class="box box-primary">
                <div class="box-header">
                    <h3 class="box-title">{{ trans('core::core.title.translatable fields') }}</h3>
                </div>
开发者ID:bitsoflove,项目名称:Site,代码行数:31,代码来源:create-or-edit.blade.php

示例12:

<!doctype html>
<html lang="ja">
	<link href="{{asset("frontend/common/css/import.css")}}" rel="stylesheet" type="text/css" media="all" />

	<script src="{{asset('/frontend/common/js/jquery.min.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.bxslider.min.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.rollover.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.flatheights.js')}}"></script>
	<script src="{{asset('/frontend/common/js/top.js')}}"></script>
	<script src="{{asset('/frontend/common/js/analytics.js')}}"></script>

@include('frontend/element/header')
<body>
<?php 
$url = LaravelLocalization::getCurrentLocale() . '/inquiry';
?>
{!! Form::open( ['method' => 'post', 'id'=>'frmContact', 'url' => $url]) !!} 	
	<section id="contact">
		<div class="container">
			<header>
				<h2 style="visibility: visible; animation-name: fadeInDown;" class="wow fadeInDown animated">{{trans('common.lbl_inquiry')}}</h2>
				<p style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;" class="wow fadeInUp animated" data-wow-delay="0.1s">{{trans('common.lbl_sub_title')}}
				</p>
			</header>
			<div class="row">
				<div class="formrow">
					<div class="form-group col-md-3 formleft">
						<span>{{trans('common.lbl_inquiry_company')}}</span><span class="icnMust">{{trans('common.icnMust')}}</span>
					</div>
					<div class="form-group col-md-9">
						<input name="company" placeholder="{{trans('common.lbl_inquiry_company')}}" class="form-control" id="company" type="text" value="{{Input::old('company')}}">
开发者ID:chiroro-vietnam,项目名称:chirorovn,代码行数:31,代码来源:input.blade.php

示例13: foreach

	<link href="{{{ Module::asset('formbuilder:css/styles.css') }}}" rel="stylesheet" type="text/css" />
@stop

@section('content')
	{!! Form::open(['route' => ['admin.formbuilder.formbuilder.update', $form->id], 'method' => 'put', 'files' => true]) !!}
	{!! Form::hidden("id", $form->id) !!}
    <div class="row">
        <div class="col-xs-12">
            <div class="nav-tabs-custom">
                @include('partials.form-tab-headers', ['fields' => ['title', 'body']])
                <div class="tab-content">
                    <?php 
$i = 0;
?>
                    <?php 
foreach (LaravelLocalization::getSupportedLocales() as $locale => $language) {
    ?>
                    <?php 
    ++$i;
    ?>
                    <div class="tab-pane {{ App::getLocale() == $locale ? 'active' : '' }}" id="tab_{{ $i }}">
                        <div class="nav-tabs-custom">
							<ul class="nav nav-tabs">
								<li class="active">
									<a data-toggle="tab" href="#tab_form_{{ $i }}" aria-expanded="false" onclick="">{!! trans('formbuilder::formbuilder.tab.form') !!}</a>
									
								</li>
								<li class="">
									<a data-toggle="tab" href="#tab_mail_{{ $i }}" aria-expanded="false" onclick="">{!! trans('formbuilder::formbuilder.tab.mail') !!}</a>
								</li>
								<li class="">
开发者ID:stone-lab,项目名称:Formbuilder,代码行数:31,代码来源:edit.blade.php

示例14: function

<?php

/**
 * Ajax Routes
 */
Route::group(['prefix' => LaravelLocalization::setLocale() . "/" . LaravelLocalization::transRoute('routes.admin'), 'middleware' => ['localize', 'localeSessionRedirect', 'localizationRedirect']], function () {
    Route::get(LaravelLocalization::transRoute('routes.blog') . '/data_blog', 'ChildrenFriendly\\Blog\\Controllers\\PostController@data_blog');
    Route::get(LaravelLocalization::transRoute('routes.blog') . '/data_blog_trash', 'ChildrenFriendly\\Blog\\Controllers\\PostController@data_blog_trashed');
});
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localize', 'localeSessionRedirect', 'localizationRedirect']], function () {
    //HOTELS
    Route::get(LaravelLocalization::transRoute('routes.admin/blog'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@index');
    Route::get(LaravelLocalization::transRoute('routes.admin/blog/trash'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@index(true)');
    Route::get(LaravelLocalization::transRoute('routes.admin/blog/new'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@create');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/store'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@store');
    Route::get(LaravelLocalization::transRoute('routes.admin/blog/edit'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@edit');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/update'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@update');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/remove'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@destroy');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/remove_force'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@forceDestroy');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/restore'), 'ChildrenFriendly\\Blog\\Controllers\\PostController@restore');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/categories/store'), 'ChildrenFriendly\\Blog\\Controllers\\CategoriesController@store');
    Route::get(LaravelLocalization::transRoute('routes.admin/blog/categories/edit'), 'ChildrenFriendly\\Blog\\Controllers\\CategoriesController@edit');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/categories/update'), 'ChildrenFriendly\\Blog\\Controllers\\CategoriesController@update');
    Route::post(LaravelLocalization::transRoute('routes.admin/blog/categories/remove'), 'ChildrenFriendly\\Blog\\Controllers\\CategoriesController@destroy');
});
开发者ID:reverserob,项目名称:Laravel-5-Blog,代码行数:25,代码来源:routes.php

示例15:

<!doctype html>
<html lang="ja">
	<link href="{{asset("frontend/common/css/import.css")}}" rel="stylesheet" type="text/css" media="all" />
	<script src="{{asset('/frontend/common/js/jquery.min.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.bxslider.min.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.rollover.js')}}"></script>
	<script src="{{asset('/frontend/common/js/jquery.flatheights.js')}}"></script>
	<script src="{{asset('/frontend/common/js/top.js')}}"></script>
	<script src="{{asset('/frontend/common/js/analytics.js')}}"></script>
@include('frontend/element/header')
<body>
<form>	
	<section id="contact">
	<?php 
$locale = LaravelLocalization::getCurrentLocale();
?>
	<?php 
$inquiry = 'frontend/element/locale/' . $locale . '/inquiry';
?>
	@include($inquiry)

	</section>
</form>
@include('frontend/element/footer')
</body>
</html>
开发者ID:chiroro-vietnam,项目名称:chirorovn,代码行数:26,代码来源:complete.blade.php


注:本文中的LaravelLocalization类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。