예제 #1
0
 public function run()
 {
     $trabajos = array("Limpieza", "albañil", "plomero", "constructor", "Domestico", "Electricidad", "Niñero", "Seguridad");
     DB::table('personal')->delete();
     $faker = Faker\Factory::create('es_VE');
     for ($i = 0; $i < 70; $i++) {
         $personal[] = array('nombre' => $faker->name, 'cedula' => $faker->numberBetween(10000000, 20000000), 'email' => $faker->email, 'cargo' => $trabajos[rand(0, 7)], 'telefono' => $faker->phoneNumber, 'residencia_id' => rand(1, 101));
     }
     Personal::insert($personal);
     $this->command->info('Personal Table Seed!');
 }
예제 #2
0
     if ($user->userCakeAddUser()) {
         if ($user->mail_failure) {
             array_push($warning_messages, lang("ACTIVATION_MAIL_NOT_SENT", array($_POST['username'], $_POST['email'])));
         }
         // Retrieve the User_ID from the database
         $userdetails = fetchUserDetails($user->clean_username);
         if (!empty($userdetails)) {
             $contact = new Contact(true, $userdetails['User_ID'], $_POST);
             $personal = new Personal(true, $userdetails['User_ID'], $_POST);
             $status = new Status(true, $userdetails['User_ID'], $_POST);
             if ($_POST['group_id'] == 1 || $_POST['group_id'] == 2) {
                 $studies = new Studies_Undergr(true, $userdetails['User_ID'], $_POST);
             }
             $inserted = array();
             $inserted['contact'] = $contact->insert();
             $inserted['personal'] = $personal->insert();
             $inserted['status'] = $status->insert();
             if ($_POST['group_id'] == 1 || $_POST['group_id'] == 2) {
                 $inserted['studies'] = $studies->insert();
             }
             // TODO Failure handling here is non-existent
             // Need to better handle the case when database insertion partially fails
             $success = true;
             foreach ($inserted as $key => $value) {
                 if ($value == false) {
                     array_push($warning_messages, lang("COULD_NOT_SAVE_IN_DATABASE", array($key)));
                 }
             }
         }
     }
 }