Beispiel #1
0
 /**
  * Set locale
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $language = Session::get('language', Config::get('app.locale'));
     $current_lang = Language::whereCode($language)->firstOrFail();
     App::setLocale($language);
     Carbon::setLocale($language);
     Session::set('current_lang', $current_lang);
     return $next($request);
 }
 /**
  * Get select list for languages
  *
  * @return mixed
  */
 protected function getSelectList()
 {
     return Language::pluck('title', 'id')->all();
 }
 /**
  * Get the query object to be processed by datatables.
  *
  * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
  */
 public function query()
 {
     $languages = Language::query();
     return $this->applyScopes($languages);
 }
 public function run()
 {
     DB::table('languages')->delete();
     Language::create(['title' => 'English', 'code' => 'en', 'site_title' => 'Blog', 'site_description' => 'My Awesome Blog']);
     //        Language::create(['title' => 'Thai', 'code' => 'th', 'site_title' => 'บล็อก', 'site_description' => 'บล็อกของฉัน']);
 }