• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Location类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中app\Location的典型用法代码示例。如果您正苦于以下问题:PHP Location类的具体用法?PHP Location怎么用?PHP Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Location类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addLocation

 public function addLocation(Request $request)
 {
     $location = new Location();
     $location->picture_id = $this->id;
     $location->getLocation($this, $request);
     $location->save();
 }
开发者ID:faltastic,项目名称:Syria-On-The-Move,代码行数:7,代码来源:Picture.php


示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Model::unguard();
     //create a user
     $user = new User();
     $user->email = "[email protected]";
     $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!');
 }
开发者ID:piyushpk89,项目名称:MasteringLaravelCode_by_Christopher_John,代码行数:64,代码来源:DatabaseSeeder.php


示例3: storeLocation

 public static function storeLocation($request)
 {
     $location = new Location();
     $location->doctor_id = $request->get('doctor_id');
     $location->address = $request->get('address');
     $location->save();
     return redirect()->back()->with('message', 'Location was added.');
 }
开发者ID:morph07,项目名称:lead-scheduler,代码行数:8,代码来源:Location.php


示例4: add

 function add(Request $request)
 {
     $this->validate($request, ['address_name' => 'required', 'postalCode_name' => 'required', 'city_name' => 'required', 'province_name' => 'required', 'country_name' => 'required']);
     $json_raw = Input::get('maps_json_name');
     $json_obj = json_decode($json_raw);
     $city = '';
     $country = '';
     $province = '';
     $street_num = '';
     $street_name = '';
     $postal_code = '';
     $lat = $json_obj[0]->geometry->location->lat;
     $lng = $json_obj[0]->geometry->location->lng;
     foreach ($json_obj[0]->address_components as $comp) {
         switch ($comp->types[0]) {
             case 'street_number':
                 //STREET NUMBER
                 $street_num = $comp->long_name;
                 break;
             case 'route':
                 //STREET NAME
                 $street_name = $comp->long_name;
                 break;
             case 'administrative_area_level_1':
                 //STATE/PROVINCE
                 $province = $comp->short_name;
                 break;
             case 'postal_code':
                 //POSTAL CODE
                 $postal_code = $comp->long_name;
                 break;
             case 'country':
                 //COUNTRY
                 $country = $comp->long_name;
                 break;
             case 'neighborhood':
             case 'locality':
                 $city = $comp->long_name;
                 break;
         }
     }
     if ($city == '' | $country == '' | $province == '' | $street_name == '' | $street_num == '' | $postal_code == '') {
         return redirect('addProperty')->withErrors(["We can't find your full address, please update your info and resubmit"]);
     }
     $property = new Location();
     $property->user()->associate(Auth::user());
     $property->street_address = $street_num . " " . $street_name;
     $property->postal_code = $postal_code;
     $property->province = $province;
     $property->country = $country;
     $property->longitude = $lng;
     $property->latitude = $lat;
     $property->city = $city;
     // $property->image_path = $filename;
     $property->save();
     return redirect('profileProperties');
 }
开发者ID:PrestonEn,项目名称:BarbaricWaffle,代码行数:57,代码来源:propertyController.php


示例5: saveLocation

 public function saveLocation(Request $request)
 {
     $location = new Location();
     $location->lattitude = $request->input('lattitude');
     $location->longitude = $request->input('longitude');
     $location->post_id = $request->input('post_id');
     $location->user_id = Auth::id();
     $location->save();
     return response()->json($location);
 }
开发者ID:sukruthmk,项目名称:cast,代码行数:10,代码来源:LocationController.php


示例6: saveReferees

 public function saveReferees(Season $season, Competition $competition, Request $request)
 {
     $data = $request->all();
     $competition->referees()->wherePivot('season_id', '=', $season->id)->detach();
     $pairs = $this->getPairs($season, $competition);
     foreach ($pairs as $pair) {
         $pair->active = 0;
         $pair->save();
     }
     $response = ['refs' => array(), 'crefs' => array()];
     $country = Country::find($data['country']);
     $refs = json_decode($data['referees'], true);
     foreach ($refs as $ref) {
         $newRef = $competition->storeReferee($ref, $season, 0, $country);
         if (array_key_exists('styled', $ref)) {
             if ($ref['styled'] == 'new') {
                 $newRef['location'] = Location::find($newRef->location_id)->name;
                 array_push($response['refs'], $newRef);
             }
         }
     }
     $crefs = json_decode($data['court_referees'], true);
     foreach ($crefs as $cref) {
         $newRef = $competition->storeReferee($cref, $season, 1, $country);
         if (array_key_exists('styled', $cref)) {
             if ($cref['styled'] == 'new') {
                 $newRef['location'] = Location::find($newRef->location_id)->name;
                 array_push($response['crefs'], $newRef);
             }
         }
     }
     $response['pairs'] = $this->getPairs($season, $competition)->toArray();
     return $response;
 }
开发者ID:dinocata,项目名称:Delegiranje,代码行数:34,代码来源:CompetitionController.php


示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(LocationRequest $request, $id)
 {
     $location = Location::findOrFail($id);
     $location->fill($request->all());
     $location->save();
     return Redirect::back()->with("good", "Successfully updated location.");
 }
开发者ID:ripixel,项目名称:polefitness,代码行数:14,代码来源:LocationController.php


示例8: getUserLocationsAndActions

 public function getUserLocationsAndActions($id)
 {
     $alluserlocation = UserLocation::Where('user_id', '=', $id)->get();
     $user_locations = Location::WhereIn('id', $alluserlocation)->get();
     $user_actions = UserAction::Where('user_id', '=', $id)->get();
     return response()->json(["Response" => "success", "Actions" => unserialize($user_actions), "Locations" => $user_locations]);
 }
开发者ID:SohaibFarooqi,项目名称:SubscriptionSystemBackend,代码行数:7,代码来源:UserController.php


示例9: 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']);
 }
开发者ID:vasitjuntong,项目名称:mixed,代码行数:12,代码来源:LocationSeeder.php


示例10: 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']);
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:37,代码来源:RandomTableSeeder.php


示例11: index

 public function index()
 {
     // $locations = Location::all();
     // return view('locations',['locations'=>$locations]);
     $locations = Location::with('stories')->get();
     return view('locations', ['locations' => $locations]);
 }
开发者ID:annievuvu,项目名称:Programming-Assignments,代码行数:7,代码来源:LocationController.php


示例12: destroy

 public function destroy($id)
 {
     $location = \App\Location::FindOrFail($id);
     $location->delete();
     \Session::flash('flash_message', 'Location has been deleted.');
     return redirect('locations');
 }
开发者ID:romulodl,项目名称:swim,代码行数:7,代码来源:LocationController.php


示例13: edit

 public function edit($id)
 {
     $activity = Activity::find($id);
     $cars = Car::lists('name', 'id');
     $customers = Customer::lists('name', 'id');
     $locations = Location::lists('name', 'id');
     $costs = null;
     $items = null;
     $ondayOtherCosts = null;
     if ($activity->type == "On Day") {
         $data = Onday::where('activity_id', '=', $id)->get()->pop();
         $ondayOtherCosts = OndayOtherCost::where('onday_id', $data->id)->get();
     } else {
         if ($activity->type == "Maintenance") {
             $data = Maintenance::where('activity_id', '=', $id)->get()->pop();
             $costs = $activity->maintenance->items;
             $items = Item::lists('name', 'id')->sort();
         } else {
             if ($activity->type == "Nil") {
                 $data = Nil::where('activity_id', '=', $id)->get()->pop();
             }
         }
     }
     return view('activity.edit', ['activity' => $activity, 'data' => $data, 'cars' => $cars, 'customers' => $customers, 'locations' => $locations, 'costs' => $costs, 'items' => $items, 'ondayOtherCosts' => $ondayOtherCosts]);
 }
开发者ID:jubaedprince,项目名称:rkt,代码行数:25,代码来源:ActivityController.php


示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $locations = Cache::remember('locations', 15, function () {
         return Location::orderBy('name')->get();
     });
     return response()->json(['data' => $locations], 200);
 }
开发者ID:wyrover,项目名称:refund-api,代码行数:12,代码来源:LocationController.php


示例15: prepareQuery

 /**
  * @return ElasticaQuery
  */
 private function prepareQuery($params, $start = null, $limit = null)
 {
     $query = null;
     $filter = null;
     $sort = ['_score' => 'desc'];
     // We'd like to search in both title and description for keywords
     if (!empty($params['keywords'])) {
         $query = new QueryString($params['keywords']);
         $query->setDefaultOperator('AND')->setFields(['title', 'description']);
     }
     // Add location filter is location is selected from autosuggest
     if (!empty($params['location_id'])) {
         $location = Location::find($params['location_id']);
         $filter = new GeoDistance('location', ['lat' => $location->lat, 'lon' => $location->lon], $params['radius'] . 'mi');
         // Sort by nearest hit
         $sort = ['_geo_distance' => ['jobs.location' => [(double) $location->lon, (double) $location->lat], 'order' => 'asc', 'unit' => 'mi']];
     }
     // If neither keyword nor location supplied, then return all
     if (empty($params['keywords']) && empty($params['location_id'])) {
         $query = new MatchAll();
     }
     // We need a filtered query
     $elasticaQuery = new ElasticaQuery(new Filtered($query, $filter));
     $elasticaQuery->addSort($sort);
     // Offset and limits
     if (!is_null($start) && !is_null($limit)) {
         $elasticaQuery->setFrom($start)->setSize($limit);
     }
     // Set up the highlight
     $elasticaQuery->setHighlight(['order' => 'score', 'fields' => ['title' => ['fragment_size' => 100], 'description' => ['fragment_size' => 200]]]);
     return $elasticaQuery;
 }
开发者ID:phpfour,项目名称:ah,代码行数:35,代码来源:Search.php


示例16: dashboard_by_location

 /**
  *
  * @return view
  */
 public function dashboard_by_location()
 {
     // summary by location
     $locations = \App\Location::where('parent_id', 0)->orderBy('name')->get();
     for ($i = 0; $i < count($locations); $i++) {
         $nodesAll = \App\Node::where('location_id', $locations[$i]->id)->get();
         $nodesUp = \App\Node::where('location_id', $locations[$i]->id)->where('ping_success', '100')->get();
         $locations[$i]->nodesUp = $nodesUp->count();
         $locations[$i]->nodesDown = $nodesAll->count() - $nodesUp->count();
         // no node assigned in this project
         if ($nodesAll->count() == 0) {
             $locations[$i]->nodesUpnPercent = 0;
             $locations[$i]->nodesDownPercent = 0;
         } else {
             $locations[$i]->nodesUpPercent = $nodesUp->count() / $nodesAll->count() * 100;
             $locations[$i]->nodesDownPercent = 100 - $locations[$i]->nodesUpPercent;
             // to prevent too small click area
             if ($locations[$i]->nodesDownPercent > 0 && $locations[$i]->nodesDownPercent < 10) {
                 $locations[$i]->nodesUpPercent -= 10;
                 $locations[$i]->nodesDownPercent += 10;
             }
             if ($locations[$i]->nodesUpPercent > 0 && $locations[$i]->nodesUpPercent < 10) {
                 $locations[$i]->nodesUpPercent += 10;
                 $locations[$i]->nodesDownPercent -= 10;
             }
         }
     }
     return view('pages.dashboard_by_location', compact('locations'));
 }
开发者ID:afdalwahyu,项目名称:lnms,代码行数:33,代码来源:PagesController.php


示例17: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->status == null) {
             $model->status = static::CREATE;
         }
         if ($model->qty == null) {
             $model->qty = 1;
         }
         if ($model->location_id != null) {
             $location = Location::find($model->location_id, ['name']);
             if ($location) {
                 $model->location_name = $location->name;
             }
         }
     });
     static::created(function ($model) {
     });
     static::updating(function ($model) {
         if ($model->qty == null) {
             $model->qty = 1;
         }
     });
 }
开发者ID:vasitjuntong,项目名称:mixed,代码行数:25,代码来源:ReceiveItem.php


示例18: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $locations = Location::all()->toArray();
     /*$receptionist = Receptionist::where('role_id', '=', 3)->get();*/
     $receptionist = DB::table('users')->where('users.role_id', '=', 3)->join('locations', 'users.location_id', '=', 'locations.id')->get(['users.*', 'locations.name as location']);
     return Response::json(array('allreceptionists' => $receptionist, 'locations' => $locations));
 }
开发者ID:subhadip-sahoo,项目名称:laravel,代码行数:12,代码来源:ReceptionistController.php


示例19: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
开发者ID:heckyeah,项目名称:ngaitauira,代码行数:31,代码来源:EventController.php


示例20: edit

 public function edit($id)
 {
     $request = Request::with(['equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'actions' => function ($query) {
         $query->orderBy('created_at', 'desc');
     }, 'actions.submitted', 'comments.author' => function ($query) {
         $query->orderBy('created_at', 'asc');
     }])->find($id);
     if (is_null($request)) {
         return view('security.not-found');
     }
     $data['request'] = $request;
     $data['areas'] = Area::all(['id', 'name']);
     $data['organizations'] = Organization::all();
     $data['categories'] = Category::all(['id', 'name']);
     $data['locations'] = Location::all(['id', 'name']);
     $data['approvers'] = Approval::getRecent($id);
     $data['hasApproved'] = Approval::hasApproved($id)->exists();
     if ($request->Status->name == 'Approved') {
         return view('request.view', $data);
     }
     if ($request->submitted_by != Auth::User()->id && !Auth::User()->hasRole(['administrator', 'approver'])) {
         return view('security.401');
     }
     return view('request.edit', $data);
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:25,代码来源:LCCBController.php



注:本文中的app\Location类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Member类代码示例发布时间:2022-05-23
下一篇:
PHP app\Language类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap