protected function importNews() { $news = DB::connection('oldissue')->select('select * from relatednewsandstatments'); foreach ($news as $n) { $newNews = new News(); $newNews->id = $n->id; $newNews->date = $n->initat; $newNews->link = $n->link ? $n->link : ''; $newNews->public_code = str_random(40); $translatableData = ['ro' => ['title' => $n->title ? $n->title : '', 'description' => $n->content ? $n->content : ''], 'en' => ['title' => $n->entitle ? $n->entitle : '', 'description' => $n->encontent ? $n->encontent : '']]; $newNews->fill($translatableData); $newNews->save(); } return print_r('Au fost importate: ' . News::count() . ' stiri.' . "\n"); }