protected function importStakeholders() { $stakeholders = DB::connection('oldissue')->select('select * from stackeholders'); foreach ($stakeholders as $stakeholder) { $newStakeholder = new Stakeholder(); $newStakeholder->id = $stakeholder->stackeholderID; $newStakeholder->name = $stakeholder->first_name . ' ' . $stakeholder->last_name; if ($stakeholder->isauth === '0') { $newStakeholder->type = 'persoana'; } else { $newStakeholder->type = 'organizatie'; } $newStakeholder->site = $stakeholder->blog; $newStakeholder->email = $stakeholder->email ? $stakeholder->email : ''; $newStakeholder->telephone = $stakeholder->phone ? $stakeholder->phone : ''; $newStakeholder->public_code = str_random(40); $translatableData = ['ro' => ['profile' => $stakeholder->profile ? $stakeholder->profile : '', 'position' => $stakeholder->posAndApart ? $stakeholder->posAndApart : '', 'address' => $stakeholder->contact ? $stakeholder->contact : ''], 'en' => ['profile' => $stakeholder->enprofile ? $stakeholder->enprofile : '', 'position' => $stakeholder->enposAndApart ? $stakeholder->enposAndApart : '', 'address' => $stakeholder->encontact ? $stakeholder->encontact : '']]; $newStakeholder->fill($translatableData); $newStakeholder->save(); } return print_r('Au fost importati: ' . Stakeholder::count() . ' stakeholders.' . "\n"); }