当前位置: 首页>>代码示例>>PHP>>正文


PHP Location::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /locations
  *
  * @return Response
  */
 public function store()
 {
     //        $validator = Location::validate(Input::only('address', 'title', 'phone', 'fax', 'description', 'url'));
     $location = new Location();
     $location->name = Input::get('location');
     $location->tiele = Input::get('title');
     $location->address = Input::get('address');
     $location->phone = Input::get('phone');
     $location->fax = Input::get('fax');
     $location->description = Input::get('description');
     $location->email = Input::get('email');
     $location->hours = Input::get('hours');
     $location->alt_txt = Input::get('alt_txt');
     if (Input::hasFile('photo')) {
         $photo = Input::file('photo');
         $filename = time() . '-' . $photo->getClientOriginalName();
         $destination = public_path() . '/img/' . $filename;
         if (!File::exists($destination)) {
             try {
                 $photo_path = $photo->move(public_path() . '/img/', $filename);
                 $location->url = $filename;
             } catch (Fileexception $e) {
                 return 'Sorry, Could not upload the file! Please, try again later!!';
             }
         } else {
             return 'This File already exist!! Please, upload another file!!!';
         }
     }
     $location->save();
     return Redirect::to('alllocations')->with('message', 'Photo uploaded Successfully');
 }
开发者ID:shankargiri,项目名称:taylor_latest,代码行数:37,代码来源:LocationsController.php

示例2: add

 public function add($attr, $image)
 {
     $model = new Post();
     $model->setAttributes($attr);
     $model->date = time();
     $model->post_comment_count = 0;
     $model->post_like_count = 0;
     $image_url = null;
     if (isset($image)) {
         $image_url = UploadHelper::getUrlUploadSingleImage($image, $attr['user_id']);
     }
     $location = new Location();
     $location->longitude = $attr['lng'];
     $location->latitude = $attr['lat'];
     $location->name = $attr['name'];
     $location->save(FALSE);
     $model->image = $image_url;
     $model->location_id = $location->location_id;
     if ($model->save(FALSE)) {
         $subject_arr = json_decode($attr['subject'], true);
         foreach ($subject_arr as $item) {
             $subject_post = new PostSubject();
             $subject_post->post_id = $model->post_id;
             $subject_post->subject_id = $item;
             $subject_post->save(FALSE);
         }
         return TRUE;
     }
     return FALSE;
 }
开发者ID:uethackathon,项目名称:uethackathon2015_team4,代码行数:30,代码来源:Post.php

示例3: save

 public function save()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $pin = Input::get('pin');
     if (isset($pin)) {
         $location = Location::where('pin', '=', $pin)->where('status', '=', 'active')->first();
         if (!isset($location)) {
             $location = new Location();
             $location->country = 'India';
             $location->state = Input::get('state');
             $location->city = Input::get('city');
             $location->pin = $pin;
             $location->status = 'active';
             $location->created_at = date("Y-m-d h:i:s");
             $location->updated_at = date("Y-m-d h:i:s");
             $location->save();
             return json_encode(array('message' => 'done'));
         } else {
             return json_encode(array('message' => 'duplicate'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }
开发者ID:ashutoshpandey,项目名称:dicom,代码行数:27,代码来源:LocationController.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('locations')->truncate();
     $locationClusterCmb = new Location();
     $locationClusterCmb->code = "CLS_001";
     $locationClusterCmb->name = "Colombo";
     $locationClusterCmb->location_type_id = 1;
     $locationClusterCmb->parent_location_id = 0;
     $locationClusterCmb->save();
     $locationRegMah = new Location();
     $locationRegMah->code = "REG_001";
     $locationRegMah->name = "Maharagama";
     $locationRegMah->location_type_id = 2;
     $locationRegMah->parent_location_id = $locationClusterCmb->id;
     $locationRegMah->save();
     $locationRegG5 = new Location();
     $locationRegG5->code = "REG_002";
     $locationRegG5->name = "Gampaha";
     $locationRegG5->location_type_id = 2;
     $locationRegG5->parent_location_id = $locationClusterCmb->id;
     $locationRegG5->save();
     $locationTmpNug = new Location();
     $locationTmpNug->code = "TMP_001";
     $locationTmpNug->name = "Nugegoda";
     $locationTmpNug->location_type_id = 3;
     $locationTmpNug->parent_location_id = $locationRegMah->id;
     $locationTmpNug->save();
 }
开发者ID:alexixim,项目名称:blood-bank,代码行数:34,代码来源:LocationsTableSeeder.php

示例5: action_add

 public function action_add()
 {
     if (Session::has('id')) {
         $account = Account::find(Session::get('id'));
         if ($account) {
             if (Input::has('address') && Input::has('city') && Input::has('postal_code')) {
                 $location = new Location();
                 $location->address = strip_tags(Input::get('address'));
                 $location->city = strip_tags(Input::get('city'));
                 $location->postal_code = strip_tags(Input::get('postal_code'));
                 if ($location->save()) {
                     return true;
                 } else {
                     return false;
                 }
             } else {
                 die('address, city or psotal_code not set');
             }
         } else {
             die('inconsistant session data');
         }
     } else {
         die('session id not found');
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:25,代码来源:location.php

示例6: add

 public function add()
 {
     $location = new LocationForm();
     $form = $location->form();
     if ($this->request->isPost()) {
         $form->setFieldValues($this->request->getPost());
         if ($form->isValid()) {
             $country_name = $this->request->getPost('lace-country-name');
             //get country
             $country_iso3 = $this->request->getPost('lace-country-iso3');
             //get iso3
             $country_iso2 = $this->request->getPost('lace-country-iso2');
             //get iso2
             $post_code = $this->request->getPost('lace-postcode');
             //get post code
             $enabled = $this->request->getPost('lace-enabled');
             //get enabled
             $location = new Location();
             $location->save(['name' => $country_name, 'iso_code_3' => $country_iso3, 'iso_code_2' => $country_iso2, 'postcode_required' => isset($post_code) ? $post_code : 0, 'status' => isset($enabled) ? $enabled : 0]);
             //redirect to country
             $this->session->setRequestValue('success', 'Country Successfully Added', 1);
             $this->response->redirect($this->request->getBasePath() . '/' . $this->request->getPath(0) . '/locations');
         }
     }
     $this->setView('location/add_country');
     $this->view->title = 'Add Location';
     $this->view->form = $form;
     $this->response->setBody($this->view->render());
     $this->response->send();
 }
开发者ID:OpenSourceAfrica,项目名称:lacecart,代码行数:30,代码来源:LocationsController.php

示例7: createNewUserLocation

 private function createNewUserLocation($latitude, $longitude, $user)
 {
     $userLocation = new Location();
     $userLocation->user_id = $user->id;
     $userLocation->latitude = $latitude;
     $userLocation->longitude = $longitude;
     return $userLocation->save();
 }
开发者ID:samuraiseoul,项目名称:f.it,代码行数:8,代码来源:AppController.php

示例8: testLocationModel

 public function testLocationModel()
 {
     $location = new Location();
     $location->name = '';
     $location->longitude = '33.979700';
     $location->latitude = '-84.001750';
     $location->description = 'A challenging maze';
     $location->save();
 }
开发者ID:Abenaman,项目名称:ggc-talk,代码行数:9,代码来源:LocationTest.php

示例9: createLocation

 /**
  * Creates a new location and returns the location Object.
  * @return [type] [description]
  */
 public function createLocation($name, $address, $website, $advisor_id = 0)
 {
     $location = new Location();
     $location->name = $name;
     $location->address = $address;
     $location->website = $website;
     $location->advisor_id = $advisor_id;
     $location->save();
     return $location;
 }
开发者ID:hvent90,项目名称:service-booker,代码行数:14,代码来源:Location.php

示例10: store

 public function store()
 {
     $location = new Location();
     $location->code = Input::get('code');
     $location->name = Input::get('name');
     $location->address = Input::get('address');
     $location->contact = Input::get('contact');
     $location->save();
     Session::flash('message', 'Sukses menambahkan cabang baru!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:10,代码来源:LocationsController.php

示例11: testDelete

 public function testDelete()
 {
     $loc = new Location();
     $loc->setBuildingID(1);
     $loc->setRoom(9999);
     $loc->save();
     $this->assertTrue(Location::locationExists($loc->getBuildingId(), $loc->getRoom()) != false);
     $loc->delete();
     $this->assertTrue(!Location::locationExists($loc->getBuildingId(), $loc->getRoom()));
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:10,代码来源:locationTest.php

示例12: handleCreate

 public function handleCreate()
 {
     $location = new Location();
     $location->name = Input::get('name');
     $location->longitude = Input::get('longitude');
     $location->latitude = Input::get('latitude');
     $location->description = Input::get('description');
     $location->save();
     return Redirect::action('LocationController@showList');
 }
开发者ID:Abenaman,项目名称:ggc-talk,代码行数:10,代码来源:LocationController.php

示例13: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'show' page.
  */
 public function actionCreate()
 {
     $model = new Location();
     if (isset($_POST['Location'])) {
         $model->attributes = $_POST['Location'];
         if ($model->save()) {
             $this->redirect(array('show', 'id' => $model->lid));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:15,代码来源:LocationController_old.php

示例14: store

 /**
  * Store a newly created resource in storage.
  * POST /location
  *
  * @return Response
  */
 public function store()
 {
     $location = new Location();
     $location->address = Input::get('address');
     $location->city = Input::get('city');
     $location->state = Input::get('state');
     $location->zip = Input::get('zip');
     $location->save();
     $locations = Location::orderBy('created_at', 'desc')->paginate(6);
     return Redirect::action('LocationController@index');
 }
开发者ID:perenchiod,项目名称:Event_Planner,代码行数:17,代码来源:LocationController.php

示例15: actionShowLocation

 public function actionShowLocation()
 {
     $model = new Location();
     if (isset($_POST['Location'])) {
         $model->attributes = $_POST['Location'];
         $model->scenario = 'mandatory';
         if ($model->save()) {
             echo 'saved';
         }
     }
     $this->render('_location_form', array('model' => $model));
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:12,代码来源:LocationController.php


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