本文整理汇总了PHP中app\Location::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::create方法的具体用法?PHP Location::create怎么用?PHP Location::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Location
的用法示例。
在下文中一共展示了Location::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Location::create(['name' => 'LO001']);
Location::create(['name' => 'LO002']);
Location::create(['name' => 'LO003']);
Location::create(['name' => 'LO004']);
}
示例2: store
public function store(LocationRequest $request)
{
$location = Location::create($request->all());
Session::flash('success', true);
Session::flash('message', 'Aðgerð tókst: Ný staðsetning');
return Redirect::back();
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('locations')->truncate();
Location::create(['name' => 'Phase 1, Level 1']);
Location::create(['name' => 'Phase 1, Level 2']);
Location::create(['name' => 'Phase 1, Level 3']);
Location::create(['name' => 'Phase 2, Level 1']);
Location::create(['name' => 'Phase 2, Level 2']);
Location::create(['name' => 'Phase 2, Level 3']);
Location::create(['name' => 'Phase 3, Level 1']);
Location::create(['name' => 'Phase 3, Level 2']);
Location::create(['name' => 'Phase 3, Level 3']);
DB::table('areas')->truncate();
Area::create(['name' => 'AME']);
Area::create(['name' => 'M&W']);
Area::create(['name' => 'Ramp']);
Area::create(['name' => 'SCI']);
Area::create(['name' => 'Tool Install']);
DB::table('categories')->truncate();
Category::create(['name' => 'Spec Gas']);
Category::create(['name' => 'Electrical']);
Category::create(['name' => 'Base Build']);
Category::create(['name' => 'Design Request']);
Category::create(['name' => 'Layout Optimization']);
Category::create(['name' => 'Safety']);
DB::table('status')->truncate();
Status::create(['name' => 'New', 'slug' => 'new']);
Status::create(['name' => 'Open/Needs Further Review', 'slug' => 'open-needs-further-review']);
Status::create(['name' => 'Waiting for Approval', 'slug' => 'waiting-for-approval']);
Status::create(['name' => 'Rejected', 'slug' => 'rejected']);
Status::create(['name' => 'Approved', 'slug' => 'approved']);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['name' => 'required', 'link' => 'required']);
Location::create($request->all());
Session::flash('message', 'Location Created');
return redirect()->action('LocationsController@create');
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('locations')->delete();
Location::create(['location_id' => '0', 'location' => 'National', 'abbrev' => 'National']);
Location::create(['location_id' => '1', 'location' => 'Texas', 'abbrev' => 'TX']);
Location::create(['location_id' => '2', 'location' => 'Alabama', 'abbrev' => 'AL']);
Location::create(['location_id' => '3', 'location' => 'Alaska', 'abbrev' => 'AK']);
Location::create(['location_id' => '4', 'location' => 'Arizona', 'abbrev' => 'AZ']);
Location::create(['location_id' => '5', 'location' => 'Arkansas', 'abbrev' => 'AR']);
Location::create(['location_id' => '384', 'location' => 'Armed Forces Americas', 'abbrev' => 'AA']);
Location::create(['location_id' => '385', 'location' => 'Armed Forces Europe', 'abbrev' => 'AE']);
Location::create(['location_id' => '386', 'location' => 'Armed Forces Pacific', 'abbrev' => 'AP']);
Location::create(['location_id' => '6', 'location' => 'California', 'abbrev' => 'CA']);
Location::create(['location_id' => '7', 'location' => 'Colorado', 'abbrev' => 'CO']);
Location::create(['location_id' => '8', 'location' => 'Connecticut', 'abbrev' => 'CT']);
Location::create(['location_id' => '10', 'location' => 'Delaware', 'abbrev' => 'DE']);
Location::create(['location_id' => '9', 'location' => 'District of Columbia', 'abbrev' => 'CO']);
Location::create(['location_id' => '11', 'location' => 'Florida', 'abbrev' => 'FL']);
Location::create(['location_id' => '12', 'location' => 'Georgia', 'abbrev' => 'GA']);
Location::create(['location_id' => '14', 'location' => 'Hawaii', 'abbrev' => 'HI']);
Location::create(['location_id' => '15', 'location' => 'Idaho', 'abbrev' => 'ID']);
Location::create(['location_id' => '17', 'location' => 'Illinois', 'abbrev' => 'IL']);
Location::create(['location_id' => '18', 'location' => 'Indiana', 'abbrev' => 'IN']);
Location::create(['location_id' => '16', 'location' => 'Iowa', 'abbrev' => 'IA']);
Location::create(['location_id' => '19', 'location' => 'Kansas', 'abbrev' => 'KS']);
Location::create(['location_id' => '20', 'location' => 'Kentucky', 'abbrev' => 'KY']);
Location::create(['location_id' => '21', 'location' => 'Louisiana', 'abbrev' => 'LA']);
Location::create(['location_id' => '22', 'location' => 'Maine', 'abbrev' => 'ME']);
Location::create(['location_id' => '23', 'location' => 'Maryland', 'abbrev' => 'MD']);
Location::create(['location_id' => '24', 'location' => 'Massachusetts', 'abbrev' => 'MA']);
Location::create(['location_id' => '25', 'location' => 'Michigan', 'abbrev' => 'MI']);
Location::create(['location_id' => '26', 'location' => 'Minnesota', 'abbrev' => 'MN']);
Location::create(['location_id' => '27', 'location' => 'Mississippi', 'abbrev' => 'MS']);
Location::create(['location_id' => '28', 'location' => 'Missouri', 'abbrev' => 'MO']);
Location::create(['location_id' => '29', 'location' => 'Montana', 'abbrev' => 'ME']);
Location::create(['location_id' => '30', 'location' => 'Nebraska', 'abbrev' => 'NE']);
Location::create(['location_id' => '31', 'location' => 'Nevada', 'abbrev' => 'NE']);
Location::create(['location_id' => '32', 'location' => 'New Hampshire', 'abbrev' => 'NH']);
Location::create(['location_id' => '33', 'location' => 'New Jersey', 'abbrev' => 'NJ']);
Location::create(['location_id' => '34', 'location' => 'New Mexico', 'abbrev' => 'MM']);
Location::create(['location_id' => '35', 'location' => 'New York', 'abbrev' => 'NY']);
Location::create(['location_id' => '36', 'location' => 'North Carolina', 'abbrev' => 'NC']);
Location::create(['location_id' => '37', 'location' => 'North Dakota', 'abbrev' => 'ND']);
Location::create(['location_id' => '38', 'location' => 'Ohio', 'abbrev' => 'OH']);
Location::create(['location_id' => '39', 'location' => 'Oklahoma', 'abbrev' => 'OK']);
Location::create(['location_id' => '40', 'location' => 'Oregon', 'abbrev' => 'OR']);
Location::create(['location_id' => '41', 'location' => 'Pennsylvania', 'abbrev' => 'PA']);
Location::create(['location_id' => '42', 'location' => 'Rhoda Island', 'abbrev' => 'RI']);
Location::create(['location_id' => '43', 'location' => 'South Carolina', 'abbrev' => 'SC']);
Location::create(['location_id' => '44', 'location' => 'South Dakota', 'abbrev' => 'SD']);
Location::create(['location_id' => '45', 'location' => 'Tennessee', 'abbrev' => 'TN']);
Location::create(['location_id' => '46', 'location' => 'Utah', 'abbrev' => 'UT']);
Location::create(['location_id' => '47', 'location' => 'Vermont', 'abbrev' => 'VT']);
Location::create(['location_id' => '48', 'location' => 'Virginia', 'abbrev' => 'VA']);
Location::create(['location_id' => '49', 'location' => 'Washington', 'abbrev' => 'WA']);
Location::create(['location_id' => '50', 'location' => 'West Virginia', 'abbrev' => 'WV']);
Location::create(['location_id' => '51', 'location' => 'Wisconson', 'abbrev' => 'WI']);
Location::create(['location_id' => '52', 'location' => 'Wyoming', 'abbrev' => 'WY']);
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
if (Location::create($request->all())) {
return redirect('location');
} else {
dd('Error! Could not add location!');
}
}
示例7: run
public function run()
{
DB::table('locations')->delete();
$locations = [['location' => 'Corporate', 'loc_abr' => 'ARM', 'address' => '2222 South Louisa Street', 'city' => 'Rayville', 'state' => 'LA', 'zip' => '71269', 'phone' => '3187285770', 'manager_id' => 5, 'region_id' => 1], ['location' => 'ARM MS', 'loc_abr' => 'CLE', 'address' => '201 E. Sunflower Road, Suite 10', 'city' => 'Cleveland', 'state' => 'MS', 'zip' => '38732', 'phone' => '6628430944', 'manager_id' => 6, 'region_id' => 2], ['location' => 'ARM Crowley', 'loc_abr' => 'CRO', 'address' => '121 East Fifth Street', 'city' => 'Crowley', 'state' => 'LA', 'zip' => '70526', 'phone' => '3372504488', 'manager_id' => 6, 'region_id' => 3], ['location' => 'ARM Jonesboro', 'loc_abr' => 'JON', 'address' => '2524 Alexander Drive, Suite D', 'city' => 'Jonesboro', 'state' => 'AR', 'zip' => '72401', 'phone' => '8703362620', 'manager_id' => 6, 'region_id' => 3], ['location' => 'ARM Rayville', 'loc_abr' => 'RAY', 'address' => '2222 Louisa Street', 'city' => 'Rayville', 'state' => 'LA', 'zip' => '71269', 'phone' => '3187285770', 'manager_id' => 7, 'region_id' => 3], ['location' => 'ARM Dexter', 'loc_abr' => 'DEX', 'address' => '325 W Business US 60', 'city' => 'Dexter', 'state' => 'MO', 'zip' => '63841', 'phone' => '5738914101', 'manager_id' => 6, 'region_id' => 3], ['location' => 'ARM Amarillo', 'loc_abr' => 'AMA', 'address' => '7116 Interstate Hwy 40 Bldg C, Ste B', 'city' => 'Amarillo', 'state' => 'TX', 'zip' => '79106', 'phone' => '8065532918', 'manager_id' => 6, 'region_id' => 3], ['location' => 'ARM Victoria', 'loc_abr' => 'VIC', 'address' => '108 E Forrest', 'city' => 'Victoria', 'state' => 'TX', 'zip' => '77901', 'phone' => '3612371717', 'manager_id' => 6, 'region_id' => 3]];
foreach ($locations as $location) {
Location::create($location);
}
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Requests\CreateLocationRequest $request)
{
//
$input = $request->all();
\Session::flash('flash_message', 'location ' . $input['name'] . ' created.');
// create
\App\Location::create($input);
return redirect('locations');
}
示例9: store
public function store(LocationRequest $request)
{
/*
get all input fields except comment which we are saving to different table
also possible to write as Request::all(), Request::except('comment') ...
*/
$newLocation = Location::create($request->all());
flash()->success('Location has been created!');
}
示例10: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Session::has('currency')) {
return $next($request);
}
$ip = $_SERVER['REMOTE_ADDR'];
$data = \SypexGeo::get($ip);
$currency = 'BYR';
if (isset($data['country']['iso'])) {
switch ($data['country']['iso']) {
case 'KZ':
case 'RU':
$currency = 'RUB';
break;
case 'BY':
$currency = 'BYR';
break;
//Euro zone countries
//Euro zone countries
case 'AT':
case 'BE':
case 'DE':
case 'GR':
case 'IE':
case 'IT':
case 'ES':
case 'CY':
case 'LV':
case 'LT':
case 'LU':
case 'MT':
case 'NL':
case 'PT':
case 'SK':
case 'SI':
case 'FI':
case 'FR':
case 'EE':
$currency = 'EUR';
break;
case 'GB':
$currency = 'GBP';
break;
default:
$currency = 'USD';
break;
}
}
Session::put('currency', $currency);
$isInBase = \App\Location::where('ip', $ip)->twentyFour()->first();
if (!$isInBase) {
\App\Location::create(['ip' => $ip]);
}
return $next($request);
}
示例11: update
public function update($id)
{
// save updated
$record = $this->records->find($id);
if (!$record) {
Location::create(Input::all());
return $this->respond($record);
}
$record->fill(Input::all())->save();
return $this->respond($record);
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$ip = $_SERVER['REMOTE_ADDR'];
$isInBase = \App\Location::where('ip', $ip)->twentyFour()->first();
if (!$isInBase) {
$data = \SypexGeo::get($ip);
$sData = serialize($data);
$visitor = \App\Location::create(['ip' => $ip, 'content' => $sData]);
}
return $next($request);
}
示例13: run
public function run()
{
\App\Location::create(array('state' => '', 'full_state' => ''));
\App\Location::create(array('state' => 'AL', 'full_state' => 'Alabama'));
\App\Location::create(array('state' => 'AK', 'full_state' => 'Alaska'));
\App\Location::create(array('state' => 'AZ', 'full_state' => 'Arizona'));
\App\Location::create(array('state' => 'AR', 'full_state' => 'Arkansas'));
\App\Location::create(array('state' => 'CA', 'full_state' => 'California'));
\App\Location::create(array('state' => 'CO', 'full_state' => 'Colorado'));
\App\Location::create(array('state' => 'CT', 'full_state' => 'Connecticut'));
\App\Location::create(array('state' => 'DE', 'full_state' => 'Delaware'));
\App\Location::create(array('state' => 'FL', 'full_state' => 'Florida'));
\App\Location::create(array('state' => 'GA', 'full_state' => 'Georgia'));
\App\Location::create(array('state' => 'HI', 'full_state' => 'Hawaii'));
\App\Location::create(array('state' => 'ID', 'full_state' => 'Idaho'));
\App\Location::create(array('state' => 'IL', 'full_state' => 'Illinois'));
\App\Location::create(array('state' => 'IN', 'full_state' => 'Indiana'));
\App\Location::create(array('state' => 'IA', 'full_state' => 'Iowa'));
\App\Location::create(array('state' => 'KS', 'full_state' => 'Kansas'));
\App\Location::create(array('state' => 'KY', 'full_state' => 'Kentucky'));
\App\Location::create(array('state' => 'LA', 'full_state' => 'Louisiana'));
\App\Location::create(array('state' => 'ME', 'full_state' => 'Maine'));
\App\Location::create(array('state' => 'MD', 'full_state' => 'Maryland'));
\App\Location::create(array('state' => 'MA', 'full_state' => 'Massachusetts'));
\App\Location::create(array('state' => 'MI', 'full_state' => 'Michigan'));
\App\Location::create(array('state' => 'MN', 'full_state' => 'Minnesota'));
\App\Location::create(array('state' => 'MS', 'full_state' => 'Mississippi'));
\App\Location::create(array('state' => 'MO', 'full_state' => 'Missouri'));
\App\Location::create(array('state' => 'MT', 'full_state' => 'Montana'));
\App\Location::create(array('state' => 'NE', 'full_state' => 'Nebraska'));
\App\Location::create(array('state' => 'NV', 'full_state' => 'Nevada'));
\App\Location::create(array('state' => 'NH', 'full_state' => 'New Hampshire'));
\App\Location::create(array('state' => 'NJ', 'full_state' => 'New Jersey'));
\App\Location::create(array('state' => 'NM', 'full_state' => 'New Mexico'));
\App\Location::create(array('state' => 'NY', 'full_state' => 'New York'));
\App\Location::create(array('state' => 'NC', 'full_state' => 'North Carolina'));
\App\Location::create(array('state' => 'ND', 'full_state' => 'North Dakota'));
\App\Location::create(array('state' => 'OH', 'full_state' => 'Ohio'));
\App\Location::create(array('state' => 'OK', 'full_state' => 'Oklahoma'));
\App\Location::create(array('state' => 'OR', 'full_state' => 'Oregon'));
\App\Location::create(array('state' => 'PA', 'full_state' => 'Pennsylvania'));
\App\Location::create(array('state' => 'RI', 'full_state' => 'Rhode Island'));
\App\Location::create(array('state' => 'SC', 'full_state' => 'South Carolina'));
\App\Location::create(array('state' => 'SD', 'full_state' => 'South Dakota'));
\App\Location::create(array('state' => 'TN', 'full_state' => 'Tennessee'));
\App\Location::create(array('state' => 'TX', 'full_state' => 'Texas'));
\App\Location::create(array('state' => 'UT', 'full_state' => 'Utah'));
\App\Location::create(array('state' => 'VT', 'full_state' => 'Vermont'));
\App\Location::create(array('state' => 'VA', 'full_state' => 'Virginia'));
\App\Location::create(array('state' => 'WA', 'full_state' => 'Washington'));
\App\Location::create(array('state' => 'WV', 'full_state' => 'West Virginia'));
\App\Location::create(array('state' => 'WI', 'full_state' => 'Wisconsin'));
\App\Location::create(array('state' => 'WY', 'full_state' => 'Wyoming'));
}
示例14: run
public function run()
{
DB::table('markers')->delete();
DB::table('locations')->delete();
Marker::create(['id' => 1, 'coordinates' => "54.9769240537932, 73.39931488037111", 'city' => 'omsk']);
Marker::create(['id' => 2, 'coordinates' => "54.975076807307914, 73.38135480880739", 'city' => 'omsk']);
Location::create(['marker_id' => 1, 'name' => "testetst", 'address' => 'f', 'time' => '12', 'type' => "restaurant", 'description' => 'ff', 'price' => '5', 'specification' => "vegetarian", 'rating' => 2]);
Location::create(['marker_id' => 1, 'name' => "edsve4wf", 'address' => 'f', 'time' => '45', 'type' => "cafe", 'description' => 'ff', 'price' => '5', 'specification' => "vegetarian", 'rating' => 4]);
Location::create(['marker_id' => 2, 'name' => "dgsg", 'time' => '34', 'address' => 'f', 'type' => "coffee", 'description' => 'ff', 'price' => '5', 'specification' => "vegan", 'rating' => 5]);
Location::create(['marker_id' => 2, 'address' => 'f', 'name' => "gmmgmm", 'time' => '12', 'type' => "restaurant", 'price' => '5', 'description' => 'ff', 'specification' => "vegetarian", 'rating' => 1]);
Location::create(['marker_id' => 2, 'address' => 'f', 'name' => "345344fr", 'time' => '12', 'type' => "restaurant", 'price' => '5', 'description' => 'ff', 'specification' => "vegetarian", 'rating' => 4]);
}
示例15: create
protected function create($values)
{
$data = [];
foreach ($this->structure as $i => $key) {
$data[$key] = $values[$i];
}
if ($data['parent_id'] == 0) {
$data['parent_id'] = null;
}
array_splice($data, 2, 3);
Location::create($data);
//Location::buildTree($data);
}