當前位置: 首頁>>代碼示例>>PHP>>正文


PHP City::create方法代碼示例

本文整理匯總了PHP中app\City::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP City::create方法的具體用法?PHP City::create怎麽用?PHP City::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\City的用法示例。


在下文中一共展示了City::create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required']);
     $item = City::create($request->all());
     Flash::success("Запись - {$item->id} сохранена");
     return redirect(route('admin.cities.index'));
 }
開發者ID:jambik,項目名稱:sellmecar,代碼行數:13,代碼來源:CitiesController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CityRequest $request)
 {
     //
     $input = Request::all();
     City::create($input);
     return redirect('addr/citys');
 }
開發者ID:seahouse,項目名稱:hxerp,代碼行數:13,代碼來源:CitysController.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     \App\City::create(['name' => 'Brisbane', 'country' => 'Australia', 'latitude' => -27.47101, 'longitude' => 153.02345]);
     // $this->call(UserTableSeeder::class);
     Model::reguard();
 }
開發者ID:neostoic,項目名稱:bestintown,代碼行數:12,代碼來源:DatabaseSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('cities')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['id', 'name'], $this->items[$i]);
         City::create($row);
     }
 }
開發者ID:jambik,項目名稱:sellmecar,代碼行數:13,代碼來源:CitiesTableSeeder.php

示例5: run

 public function run()
 {
     $cities = ['Bristol'];
     foreach ($cities as $city) {
         City::create(['name' => $city]);
         $this->command->info('Creating ' . $city);
     }
 }
開發者ID:robjmills,項目名稱:craftbeerfinder,代碼行數:8,代碼來源:CitiesTableSeeder.php

示例6: run

 public function run()
 {
     DB::table('cities')->delete();
     City::create(['country_id' => 1, 'name' => 'Ho Chi Minh']);
     City::create(['country_id' => 1, 'name' => 'Ha Noi']);
     City::create(['country_id' => 1, 'name' => 'Hue']);
     City::create(['country_id' => 2, 'name' => 'Paris']);
     City::create(['country_id' => 3, 'name' => 'London']);
 }
開發者ID:AlSt2015,項目名稱:jobs4creative,代碼行數:9,代碼來源:DatabaseSeeder.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['city_name' => 'required']);
     if ($validator->fails()) {
         return redirect('admin/cities/create')->withErrors($validator)->withInput();
     } else {
         City::create($request->all());
         return redirect('admin/cities');
     }
 }
開發者ID:roopunk,項目名稱:fashionove,代碼行數:15,代碼來源:CitiesController.php

示例8: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('cities', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('iata')->unique();
         $table->integer('user_id');
         $table->timestamps();
     });
     City::create(['name' => 'Manchester', 'iata' => 'mcr']);
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:16,代碼來源:2016_02_16_103854_create_cities_table.php

示例9: postSetup

 /**
  * Sets up the user and the city for the game
  *
  * @param Request $request
  * @return \Illuminate\View\View
  */
 public function postSetup(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user = Auth::user();
     $nation = $request->input('nation');
     $user->setNation($nation);
     $hex_id = Grid::randomHex()->id;
     $name = $request->input('name');
     City::create(['name' => $name, 'nation' => $user->nation, 'capital' => true, 'owner' => $user->id, 'hex_id' => $hex_id]);
     return redirect('home');
 }
開發者ID:nadapapa,項目名稱:PHP-RTS-game,代碼行數:20,代碼來源:SetupController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateCityRequest $request)
 {
     City::create($request->all());
     return redirect()->route('settings.city.index');
 }
開發者ID:raulbravo23,項目名稱:salepoint,代碼行數:10,代碼來源:CitysController.php

示例11: store

 public function store()
 {
     $input = Request::all();
     City::create($input);
     return redirect('cities');
 }
開發者ID:ptcarino,項目名稱:projectdiwa,代碼行數:6,代碼來源:CitiesController.php

示例12: storeCity

 /**
  * Store newly created City in storage
  * @param MyConfigRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function storeCity(MyConfigRequest $request)
 {
     City::create($request->all());
     Session::flash('success_message', 'City has been inserted');
     return redirect('config');
 }
開發者ID:smartrahat,項目名稱:zamzam,代碼行數:11,代碼來源:MyConfigController.php

示例13: addCities

 public static function addCities(Request $request)
 {
     $changecities = $request->input();
     foreach ($changecities as $city) {
         $del = suggestCity::where('idsuggestcity', $city['idsuggestcity'])->first();
         suggestCity::where('idsuggestcity', $city['idsuggestcity'])->delete();
         if ($city['pick']) {
             $cityAdd = array('cityname' => $del['suggestcityname'], 'state' => $del['suggeststatename']);
             $cityAdd = City::create($cityAdd);
         }
     }
     return \Response::json('Done');
 }
開發者ID:salkomaci,項目名稱:FixYourCity,代碼行數:13,代碼來源:ApiController.php

示例14: create

 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function create(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255']);
     City::create($request->all());
     return redirect()->route('admin::city');
 }
開發者ID:w1lliams,項目名稱:sh,代碼行數:10,代碼來源:CityController.php

示例15: add_city

 public function add_city(Request $request)
 {
     $city_data = ['name' => $request->name, 'user_id' => Auth::id()];
     City::create($city_data);
     return redirect('cities');
 }
開發者ID:Artemidas,項目名稱:city_api,代碼行數:6,代碼來源:CityController.php


注:本文中的app\City::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。