本文整理匯總了PHP中app\Country類的典型用法代碼示例。如果您正苦於以下問題:PHP Country類的具體用法?PHP Country怎麽用?PHP Country使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Country類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: countries
/**
* Display a listing of the resource.
*
* @return Response
*/
public function countries()
{
$results = \Excel::load('country_list.xlsx', function ($reader) {
})->get();
foreach ($results as $row) {
$country = new Country();
$country->country_code = $row->country_code;
$country->country_name = $row->country_name;
$country->country_name_in_albanian = $row->country_name_in_albanian;
$country->country_name_in_czech = $row->country_name_in_czech;
$country->country_name_in_dutch_belgium = $row->country_name_in_dutch_belgium;
$country->country_name_in_finnish = $row->country_name_in_finnish;
$country->country_name_in_greek = $row->country_name_in_greek;
$country->country_name_in_hungarian = $row->country_name_in_hungarian;
$country->country_name_in_kazakh = $row->country_name_in_kazakh;
$country->country_name_in_macedonian = $row->country_name_in_macedonian;
$country->country_name_in_polish = $row->country_name_in_polish;
$country->country_name_in_portuguese = $row->country_name_in_portuguese;
$country->country_name_in_romanian = $row->country_name_in_romanian;
$country->country_name_in_russian = $row->country_name_in_russian;
$country->country_name_in_slovak = $row->country_name_in_slovak;
$country->country_name_in_spanish = $row->country_name_in_spanish;
$country->country_name_in_turkish = $row->country_name_in_turkish;
$country->continent = $row->continent;
$country->iseurope = $row->iseurope;
$country->save();
}
}
示例2: setCountry
/**
* Set the country that should be delivered to.
*
* @param Country $country
* @throws InvalidArgumentException
*/
public function setCountry(Country $country)
{
if (!$country->canBeShippedTo()) {
throw new InvalidArgumentException(trans('countries.cannot_be_shipped_to', ['name' => $country->name]));
}
$this->country = $country;
}
示例3: run
public function run()
{
DB::table('countries')->truncate();
$country = new Country();
$country->name = 'England';
$country->country_code = 'EN';
// $language->icon = "icon_flag_gb.gif";
$country->icon = "flag-en";
$country->save();
$country = new Country();
$country->name = 'Ukraine';
$country->country_code = 'UA';
// $language->icon = "icon_flag_sr.gif";
$country->icon = "flag-ua";
$country->save();
$country = new Country();
$country->name = 'Russia';
$country->country_code = 'RU';
// $language->icon = "icon_flag_bs.gif";
$country->icon = "flag-ru";
$country->save();
$country = new Country();
$country->name = 'USA';
$country->country_code = 'US';
// $language->icon = "icon_flag_bs.gif";
$country->icon = "flag-us";
$country->save();
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Model::unguard();
//create a user
$user = new User();
$user->email = "hotel@test.com";
$user->password = Hash::make('password');
$user->save();
//create a country
$country = new Country();
$country->name = "United States";
$country->id = 236;
$country->save();
//create a state
$state = new State();
$state->name = "Pennsylvania";
$state->id = 1;
$state->save();
$city = new City();
$city->name = "Pittsburgh";
$city->id = 1;
$city->save();
//create a location
$location = new Location();
$location->city_id = $city->id;
$location->state_id = $state->id;
$location->country_id = $country->id;
$location->latitude = 40.44;
$location->longitude = 80;
$location->code = '15212';
$location->address_1 = "100 Main Street";
$location->save();
//create a new accommodation
$accommodation = new Accommodation();
$accommodation->name = "Royal Plaza Hotel";
$accommodation->location_id = $location->id;
// $location->id;
$accommodation->description = "A modern, 4-star hotel";
$accommodation->save();
//create a room
$room1 = new App\Room();
$room1->id = 1;
$room1->room_number = 'A01';
$room1->accommodation_id = $accommodation->id;
$room1->save();
//create another room
$room2 = new Room();
$room2->id = 2;
$room2->room_number = 'A02';
$room2->accommodation_id = $accommodation->id;
$room2->save();
//create the room array
$rooms = [$room1, $room2];
//$this->call('AuthorsTableSeeder');
//$this->command->info('Authors table seeded!');
//
$this->call(AmenityTableSeeder::class);
$this->command->info('Amenity Class Seeded table seeded!');
}
示例5: run
public function run()
{
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
DB::table('country')->truncate();
$country_nz = ['name' => "New Zealand", 'meta_desc' => "New Zealand is an island country in the southern Pacific Ocean. The country comprises two main landmasses – the North Island, South Island, and others.", 'long_desc' => "New Zealand (Māori: Aotearoa) is an island country in the southwestern Pacific Ocean. The country geographically comprises two main landmasses – that of the North Island, or Te Ika-a-Māui, and the South Island, or Te Waipounamu – and numerous smaller islands. New Zealand is situated some 1,500 kilometres (900 mi) east of Australia across the Tasman Sea and roughly 1,000 kilometres (600 mi) south of the Pacific island areas of New Caledonia, Fiji, and Tonga. Because of its remoteness, it was one of the last lands to be settled by humans. During its long isolation, New Zealand developed a distinctive biodiversity of animal, fungal and plant life. The country's varied topography and its sharp mountain peaks, such as the Southern Alps, owe much to the tectonic uplift of land and volcanic eruptions. New Zealand's capital city is Wellington, while its most populous city is Auckland.", 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()];
$country = new Country($country_nz);
$country->save();
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
}
示例6: findOrCreate
public static function findOrCreate($data)
{
$country = self::where('name', $data['country'])->first();
if (count($country) <= 0) {
$country = new Country();
$country->name = $data['country'];
$country->save();
}
return $country;
}
示例7: postCountry
public function postCountry(Request $request)
{
$name = $request['country_name'];
$description = $request['country_description'];
$status = true;
$country = new Country();
$country->name = $name;
$country->description = $description;
$country->status = $status;
$country->save();
return redirect()->route('country')->with(['message' => 'Successfully Saved!']);
}
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$country = Country::find($request->country_id);
$city = City::find($request->city_id);
$state = State::find($request->state_id);
return ['country' => $country->name, 'city' => $city->name, 'state' => $state->name];
}
示例9: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$countries = Cache::remember('countries', 15, function () {
return Country::orderBy('name')->get();
});
return response()->json(['data' => $countries], 200);
}
示例10: ShowBranchProfile
public function ShowBranchProfile($id, $branchid)
{
$update = PartnerBranch::where('id', $branchid)->first();
$countries = Country::all();
$partnerid = Partner::find($id);
return view('deskpad/updatebranch', compact('update', 'partnerid', 'countries'));
}
示例11: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(EditCountryRequest $request, $id)
{
$country = Country::findOrFail($id);
$country->fill($request->all());
$country->save();
return redirect()->route('settings.country.index');
}
示例12: edit
public function edit($id)
{
$countries = Country::orderBy('name', 'asc')->lists('name', 'id')->all();
$clubs = Club::orderBy('name', 'asc')->get()->lists('name_town', 'id')->all();
$competitor = Competitor::whereId($id)->firstOrFail();
return view('backend.competitors.edit', compact('competitor', 'countries', 'clubs'));
}
示例13: edit
public function edit($id)
{
$countries = Country::orderBy('name', 'asc')->lists('name', 'id')->all();
$categories = Category::lists('category', 'category')->all();
$competition = Competition::whereId($id)->firstOrFail();
return view('backend.competitions.edit', compact('competition', 'countries', 'categories'));
}
示例14: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$countries = \App\Country::all();
foreach ($countries as $country) {
echo "DB::table('country')->insert(['cc_fips' => '{$country->cc_fips}','cc_iso' => '{$country->cc_iso}','cc_tld' => '{$country->cc_tld}','country_name' => '{$country->country_name}',]); \n";
}
}
示例15: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 20; $i++) {
\App\Country::create(['title' => $faker->unique()->country]);
}
}