Example #1
0
 /**
  * Show a page to create a new image
  * @return \Response
  */
 public function getCreate()
 {
     // get list of countries
     $countryModel = new \App\Country();
     $countries_for_dropdown = $countryModel->getCountriesForDropdown();
     // get list of tags
     $tagModel = new \App\Tag();
     $tags_for_dropdown = $tagModel->getTagsForDropdown();
     return view('images.create')->with('countries_for_dropdown', $countries_for_dropdown)->with('tags_for_dropdown', $tags_for_dropdown);
 }
Example #2
0
 function getExample5()
 {
     $date = new \App\Date();
     $date->date = '2013-06-02';
     $date->save();
     dump($date->toArray());
     $country = new \App\Country();
     $country->country = 'India';
     $country->save();
     dump($country->toArray());
     $image = new \App\Image();
     $image->caption = 'Indian Railways';
     $image->narrative = 'Trains running late may catch up time';
     $image->filename = '2013-06-02-0157-1920.jpg';
     $image->date()->associate($date);
     //$image->date_id = $date->id;
     $image->country()->associate($country);
     $image->save();
     dump($image->toArray());
 }
 public function testUpdateRegional()
 {
     // Route
     $user = $this->getSuperUser();
     $page = route('user.regional');
     // Form
     $button = _('Save');
     $input = ['country_id' => App\Country::firstOrFail()->getKey(), 'language_id' => App\Language::firstOrFail()->getKey()];
     // Database
     $table = 'users';
     $data = $input + ['id' => $user->getKey()];
     // Test
     $this->missingFromDatabase($table, $data)->actingAs($user)->visit($page)->submitForm($button, $input)->seePageIs($page)->assertSessionHasNoErrors()->seeInDatabase($table, $data);
 }