当前位置: 首页>>代码示例>>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;未经允许,请勿转载。