public function run() { DB::table('fachkrafte')->delete(); Eloquent::unguard(); $installateure = DB::table('installateure')->get(); $faker = Faker\Factory::create('de_DE'); foreach ($installateure as $installateur) { $fachkraft = Fachkraft::firstOrNew(["installateur_id" => $installateur->id]); $fachkraft->vorname = $faker->firstName; $fachkraft->nachname = $faker->name; $fachkraft->save(); } }
public function postInstallateur() { $input = Input::all(); $inst = Installateur::firstOrNew(["user_id" => Auth::user()->id]); $inst->fill($input); $inst->save(); $fachkraft = Fachkraft::firstOrNew(["installateur_id" => $inst->id]); $fachkraft->fill($input); $fachkraft->save(); $inst = $this->getInstallateurInstance(); return Redirect::back()->withInst($inst); }