本文整理汇总了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');
}
示例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;
}
示例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'));
}
}
示例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();
}
示例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');
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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!');
}
示例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()));
}
示例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');
}
示例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));
}
示例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');
}
示例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));
}