예제 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $aboutPage = new Page();
     $aboutPage->slug = 'about';
     $aboutPage->status = 'active';
     $aboutPage->translateOrNew('kg')->title = 'Биз жөнүндө';
     $aboutPage->translateOrNew('ru')->title = 'О нас';
     $aboutPage->translateOrNew('kg')->content = str_random(500);
     $aboutPage->translateOrNew('ru')->content = str_random(500);
     $aboutPage->save();
 }
예제 #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title.ru' => 'required', 'title.kg' => 'required', 'status' => 'required']);
     $page = new Page();
     $page->slug = $request->input('slug') ? $request->input('slug') : str_slug($request->input('title')[config('app.fallback_locale')]);
     $page->status = $request->input('status');
     foreach (config('laravellocalization.supportedLocales') as $locale => $language) {
         $page->translateOrNew($locale)->title = $request->input('title')[$locale];
         $page->translateOrNew($locale)->content = $request->input('content')[$locale];
     }
     $page->save();
     return \Redirect::route('admin.page.index');
 }