本文整理汇总了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'));
}
示例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');
}
示例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();
}
示例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);
}
}
示例5: run
public function run()
{
$cities = ['Bristol'];
foreach ($cities as $city) {
City::create(['name' => $city]);
$this->command->info('Creating ' . $city);
}
}
示例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']);
}
示例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');
}
}
示例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']);
}
示例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');
}
示例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');
}
示例11: store
public function store()
{
$input = Request::all();
City::create($input);
return redirect('cities');
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}