Ejemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $countries = \CountryState::getCountries();
     $states = \CountryState::getStates('US');
     $contact = User::find($id);
     $types = UserType::lists('name', 'id');
     empty($contact->country) ? $contact->country = 'US' : $contact->country;
     return view('contacts.edit', ['
         title' => 'Edit Contact: ' . $contact->fullname, 'contact' => $contact, 'states' => $states, 'countries' => $countries, 'types' => $types]);
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     User::create(['firstname' => 'Tim', 'lastname' => 'Bradshaw', 'email' => '*****@*****.**', 'password' => Hash::make('jackass'), 'phone' => '3076904269'])->types()->sync([3, 1]);
     User::create(['firstname' => 'Chris', 'lastname' => 'Rundlett', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'phone' => '2069727245'])->types()->sync([3]);
     User::create(['firstname' => 'Chrystal', 'lastname' => 'Young', 'email' => '*****@*****.**', 'password' => Hash::make('secret'), 'phone' => '2069727245'])->types()->sync([3]);
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         User::create(['firstname' => $faker->firstname, 'lastname' => $faker->lastname, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'city' => $faker->city, 'state' => $faker->stateAbbr, 'country' => array_search($faker->country, \CountryState::getCountries())])->types()->sync([1, rand(2, 6)]);
     }
 }
 public function testGetCountries()
 {
     $countries = CountryState::getCountries();
     $this->assertRegExp("/([A-Z]{2})/", key($countries));
     $this->assertEquals("Canada", $countries['CA']);
 }