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


PHP app\Language类代码示例

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


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

示例1: run

 public function run()
 {
     DB::table('languages')->delete();
     $language = new Language();
     $language->name = 'English';
     $language->lang_code = 'gb';
     $language->save();
 }
开发者ID:RMMusic,项目名称:CSE,代码行数:8,代码来源:LanguageTableSeeder.php

示例2: index

 public function index(Request $request)
 {
     $language = $request->route('language');
     if (!$language) {
         $language = new Language();
         $default_language = $language->getDefaultLanguage();
     } else {
         $default_language = $language;
     }
     return redirect("/{$default_language}/index");
 }
开发者ID:VoDongMy,项目名称:VoDongMy,代码行数:11,代码来源:HomeController.php

示例3: getEdit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id)
 {
     $newscategory = ArticleCategory::find($id);
     $language = $newscategory->language_id;
     $languages = Language::all();
     return view('backend.newscategory.create_edit', compact('newscategory', 'languages', 'language'));
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:13,代码来源:ArticleCategoriesController.php

示例4: getEdit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id)
 {
     $photoalbum = PhotoAlbum::find($id);
     $language = $photoalbum->language_id;
     $languages = Language::all();
     return view('backend.photoalbum.create_edit', compact('photoalbum', 'languages', 'language'));
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:13,代码来源:PhotoAlbumController.php

示例5: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     // bind article
     $router->model('article', 'App\\Article');
     $router->bind('admin.article', function ($id) {
         return \App\Article::findOrFail($id);
     });
     // bind category
     $router->model('category', 'App\\Category');
     $router->bind('admin.category', function ($id) {
         return \App\Category::findOrFail($id);
     });
     // bind language
     $router->model('language', 'App\\Language');
     $router->bind('admin.language', function ($id) {
         return \App\Language::findOrFail($id);
     });
     // bind language
     $router->model('page', 'App\\Page');
     $router->bind('admin.page', function ($id) {
         return \App\Page::findOrFail($id);
     });
     // bind setting
     $router->model('setting', 'App\\Setting');
     $router->bind('admin.setting', function ($id) {
         return \App\Setting::findOrFail($id);
     });
     // bind user
     $router->model('user', 'App\\User');
     $router->bind('admin.user', function ($id) {
         return \App\User::findOrFail($id);
     });
     parent::boot($router);
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:40,代码来源:RouteServiceProvider.php

示例6: getCreate

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getCreate()
 {
     $languages = Language::all();
     $language = "";
     // Show the page
     return view('admin.objecttype.create_edit', compact('languages', 'language'));
 }
开发者ID:Avimunk,项目名称:jini_1,代码行数:12,代码来源:ObjectTypesController.php

示例7: changeApplicationLanguage

 /**
  * Change the application language.
  *
  * @param  string
  * @return Response
  */
 public function changeApplicationLanguage($code)
 {
     if ($language = \App\Language::whereCode($code)->first()) {
         event('language.change', $language);
     }
     return redirect(\URL::previous() ?: route('home'));
 }
开发者ID:superdol,项目名称:Wiki,代码行数:13,代码来源:HomeController.php

示例8: getEdit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id)
 {
     $videoalbum = VideoAlbum::find($id);
     $language = $videoalbum->language_id;
     $languages = Language::all();
     return view('admin.videoalbum.create_edit', compact('videoalbum', 'languages', 'language'));
 }
开发者ID:nickeblewis,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:13,代码来源:VideoAlbumController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(StoreLanguageRequest $request, $id)
 {
     Language::find($id)->update($request->all());
     // flash message
     session()->flash('flash_message', 'Language updated successfully.');
     return redirect()->route('languages.index');
 }
开发者ID:noorxbyte,项目名称:vultex,代码行数:14,代码来源:LanguagesController.php

示例10: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Event::listen('language.change', function (Language $language) {
         // Change application language
         $language->apply()->remember();
         // Update user's language
         if ($user = Auth::user()) {
             $user->language()->associate($language)->save();
         }
         // Feedback
         Session::flash('success', sprintf(_('Language changed to %s'), $language->native_name));
     });
     Event::listen('auth.login', function (User $user) {
         // Change application language to current user's language
         if ($user->language instanceof Language) {
             $user->language->apply()->remember();
         }
         // Stats
         $user->increment('login_count');
         $user->provider->increment('login_count');
         // Feedback
         Session::flash('success', sprintf(_('Logged in as %s'), $user));
     });
     Event::listen('auth.logout', function (User $user) {
         // Feedback
         Session::flash('success', _('Logged out'));
         // Reset default application language
         Language::forget();
     });
 }
开发者ID:superdol,项目名称:Wiki,代码行数:37,代码来源:EventServiceProvider.php

示例11: update

 /**
  * Update the specified resource in storage.
  * PUT /languages/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $language = Language::findOrFail($id);
     $this->validate($request, Language::$rules);
     $language->update($request->all());
     return redirect('languages')->with('success', l('This record has been successfully updated &#58&#58 (:id) ', ['id' => $id], 'layouts') . $request->get('name'));
 }
开发者ID:rogerapras,项目名称:aBillander,代码行数:14,代码来源:LanguagesController.php

示例12: edit

 public function edit($id)
 {
     if (Request::isMethod('get')) {
         $roles = UserRole::orderBy('id', 'desc')->get();
         $info = User::find($id);
         $cats = BlogCategory::where('lang_code', $info->userblog->lang_code)->get();
         $langs = Language::all();
         return view('admin.users.edit', array('cats' => $cats, 'langs' => $langs, 'info' => $info, 'roles' => $roles));
     }
     // POST
     parse_str(Request::input('data'));
     $category_save = implode(',', $category);
     $u = User::find($id);
     $u->name = $name;
     $u->address = $address;
     $u->zipcode = $zipcode;
     $u->city = $city;
     $u->phone = $phone;
     $u->cpr = $cpr;
     $u->role = $role;
     $u->account_number = $account_number;
     if ($password != null || $password != '') {
         $u->password = Hash::make($password);
     }
     $u->save();
     $info_update = array('blogname' => $blogname, 'domain' => $blogurl, 'lang_code' => $lang_code, 'blog_categories' => $category_save);
     UserBlog::where('user_id', $id)->update($info_update);
 }
开发者ID:namcoder,项目名称:Topshare,代码行数:28,代码来源:UserController.php

示例13: run

 public function run()
 {
     DB::table('languages')->delete();
     $language = new Language();
     $language->name = 'English';
     $language->lang_code = 'gb';
     $language->save();
     $language = new Language();
     $language->name = 'Српски';
     $language->lang_code = 'rs';
     $language->save();
     $language = new Language();
     $language->name = 'Bosanski';
     $language->lang_code = 'ba';
     $language->save();
 }
开发者ID:zcosmin20,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:16,代码来源:LanguageTableSeeder.php

示例14: handle

 /**
  * Execute the job.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle()
 {
     // Language.
     $language = Language::findOrNew(1);
     if (!$language->id) {
         $language->id = 1;
         $language->name = 'english';
         $language->prefix = 'en';
         $language->save();
     }
     // Country.
     $country = Country::findOrNew(1);
     if (!$country->id) {
         $country->id = 1;
         $country->name = 'spain';
         $country->prefix = 'spa';
         $country->save();
     }
     // User.
     $user = User::findOrNew(1);
     if (!$user->id) {
         $user->id = 1;
         $user->name = 'Test';
         $user->surname = 'Test';
         $user->email = 'test@test.com';
         $user->direction = 'this should be called address lol';
         $user->birthday = '2000-01-01';
         $user->language_id = $language->id;
         $user->country_id = $country->id;
         $user->save();
     }
     $created = $user->tasks()->create($this->requestParams);
     return response()->json($created);
 }
开发者ID:juboba,项目名称:Luminosity,代码行数:39,代码来源:CreateTaskJob.php

示例15: translate_file

 public function translate_file($code, $file)
 {
     /*
     	- This function will get all rows in English file
     	- Compare with the language need to translate
     */
     $folder = base_path() . '/resources/lang/';
     $lang_folder = $folder . $code;
     if (Request::isMethod('get')) {
         $lang_name = Language::where('code', $code)->first();
         $en_rows = file_get_contents($folder . 'en/' . $file);
         $check_exist_new_file = file_exists($folder . $code . '/' . $file);
         if (!$check_exist_new_file) {
             fopen($lang_folder . '/' . $file, "w");
         }
         $lang_rows = file_get_contents($folder . $code . '/' . $file);
         /// regex english
         preg_match('/\\[(.*)\\]/is', $en_rows, $en_each_row);
         $row = explode("\n", trim($en_each_row[1]));
         foreach ($row as $key => $value) {
             $remove_phay = str_replace("'", '', $value);
             $temp = str_replace(",", '', $remove_phay);
             $split_row[] = explode('=>', $temp);
         }
         // regex lang
         $regex_lang = preg_match('/\\[(.*)\\]/is', $lang_rows, $lang_each_row);
         if ($regex_lang) {
             $row_lang = explode("\n", trim($lang_each_row[1]));
             foreach ($row_lang as $key_lang => $value_lang) {
                 $remove_phay_lang = str_replace("'", '', $value_lang);
                 $temp_lang = str_replace(",", '', $remove_phay_lang);
                 $split_row_lang[] = explode('=>', $temp_lang);
             }
         } else {
             $split_row_lang = null;
         }
         return view('admin.language.translate-file', array('lang_name' => $lang_name, 'rows' => $split_row, 'rows_lang' => $split_row_lang));
     }
     /// POST Method . Save the submit form
     $data = Request::all();
     $myfile = fopen($lang_folder . '/' . $file, "w");
     // begin of file
     $txt = "<?php return [\n";
     fwrite($myfile, $txt);
     foreach ($data['tranfield'] as $key => $value) {
         if ($value != null || $value != '') {
             $txt2 = "'" . trim($data['key'][$key]) . "' => '" . $value . "',\n";
             fwrite($myfile, $txt2);
         } else {
             $txt2 = "'' => '" . $value . "',\n";
             fwrite($myfile, $txt2);
         }
     }
     /// end of file
     $txt = "\n];";
     fwrite($myfile, $txt);
     fclose($myfile);
     return redirect('admin/languages/translate/' . $code . '/' . $file)->with('ok', 'Save successful');
 }
开发者ID:namcoder,项目名称:Topshare,代码行数:59,代码来源:LanguageController.php


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