當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Service::save方法代碼示例

本文整理匯總了PHP中Service::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Service::save方法的具體用法?PHP Service::save怎麽用?PHP Service::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Service的用法示例。


在下文中一共展示了Service::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionAddAjax

 public function actionAddAjax()
 {
     if (!isset(Yii::app()->user->storeID)) {
         $data['message'] = '<div class="alert alert-success">Store not found. </div>';
         echo json_encode($data);
         exit;
     }
     $model = new Service();
     if (isset($_POST['Service'])) {
         $model->attributes = $_POST['Service'];
         $data = array();
         $mss = '';
         if (count($data) == 0) {
             $model->pk_s_id = '-1';
             $model->i_flag_sync = 1;
             $model->i_flag_deleted = 0;
             $model->i_disable = 0;
             if ($model->save()) {
                 $model->pk_s_id = 'SV' . $model->id;
                 if ($model->save()) {
                     $data['option'] = '<option selected="selected" value ="' . $model->pk_s_id . '">' . $model->s_name . '</option>';
                     $data['message'] = '<div class="alert alert-success">Success! Account created. </div>';
                 } else {
                     $model->delete();
                     $data['message'] = '<div class="alert alert-danger">Error! Please try again later.</div>';
                 }
             } else {
                 $data['message'] = json_encode($model->errors);
                 //'<div class="alert alert-danger">Error! Please try again later2.</div>';
             }
         }
         echo json_encode($data);
     }
 }
開發者ID:hson91,項目名稱:posnail,代碼行數:34,代碼來源:ServiceController.php

示例2: save

 /**
  * Updates or inserts a contact
  * @param Service $service
  * @return self
  * @throws NotValidException
  */
 public function save(Service $service)
 {
     if (!$this->validate()) {
         throw new NotValidException('Unable to validate contact');
     }
     return $this->reload($service->save($this));
 }
開發者ID:ASDAFF,項目名稱:MODX-MoneyBird,代碼行數:13,代碼來源:Contact.php

示例3: create

 public function create($permalink = null)
 {
     $event = self::load_event($permalink);
     $service = new Service();
     if ($this->post) {
         $service->event_id = $event->id;
         $service->cost = UnMoney($_POST['cost']);
         $service->capacity = $_POST['capacity'];
         $service->participant = $_POST['participant'];
         $service->hidden = $_POST['hidden'];
         $service->name = $_POST['name'];
         $service->description = $_POST['description'];
         $service->advanced = $_POST['advanced'];
         $service->question = $_POST['question'];
         $service->max_per_signup = $_POST['max_per_signup'];
         $service->discountable = $this->PostData("discountable");
         if ($service->save()) {
             Site::Flash("notice", "The service has been added");
             Redirect("admin/events/{$event->permalink}/services");
         }
     }
     $this->assign("event", $event);
     $this->assign("service", $service);
     $this->title = "Add Service";
     $this->render("service/create.tpl");
 }
開發者ID:ItsHaden,項目名稱:epicLanBootstrap,代碼行數:26,代碼來源:service.controller.php

示例4: update_service

 public function update_service($service_id = NULL)
 {
     if (is_null($service_id)) {
         add_error_flash_message('Služba sa nenašla.');
         redirect(site_ur('services'));
     }
     $this->db->trans_begin();
     $service = new Service();
     $service->get_by_id((int) $service_id);
     if (!$service->exists()) {
         $this->db->trans_rollback();
         add_error_flash_message('Služba sa nenašla.');
         redirect(site_ur('services'));
     }
     build_validator_from_form($this->get_form());
     if ($this->form_validation->run()) {
         $service_data = $this->input->post('service');
         $service->from_array($service_data, array('title', 'price'));
         if ($service->save() && $this->db->trans_status()) {
             $this->db->trans_commit();
             add_success_flash_message('Služba s ID <strong>' . $service->id . '</strong> bola úspešne upravená.');
             redirect(site_url('services'));
         } else {
             $this->db->trans_rollback();
             add_error_flash_message('Službu s ID <strong>' . $service->id . '</strong> sa nepodarilo upraviť.');
             redirect(site_url('services/edit_service/' . (int) $service->id));
         }
     } else {
         $this->db->trans_rollback();
         $this->edit_service($service->id);
     }
 }
開發者ID:andrejjursa,項目名稱:lstme-ledcoin,代碼行數:32,代碼來源:services.php

示例5: save

 function save($id = FALSE)
 {
     if ($_POST) {
         $category = new Category($id);
         $_POST['module'] = "services";
         $_POST['name'] = lang_encode($_POST['name']);
         $category->from_array($_POST);
         $category->save();
         if ($_POST['title']['th']) {
             foreach ($_POST['title']['th'] as $key => $item) {
                 $service = new Service(@$_POST['sub_id'][$key]);
                 if ($item) {
                     $title = array('th' => $_POST['title']['th'][$key], 'en' => $_POST['title']['en'][$key]);
                     $service->title = lang_encode($title);
                     $service->category_id = $category->id;
                     $service->save();
                 }
             }
             // exit;
         }
         set_notify('success', lang('save_data_complete'));
     }
     // redirect($_POST['referer']);
     // redirect($_SERVER['HTTP_REFERER']);
     redirect('services/admin/services');
 }
開發者ID:unisexx,項目名稱:imac,代碼行數:26,代碼來源:services.php

示例6: _start

 /**
  * SetUp
  */
 protected function _start()
 {
     $this->table = Doctrine::getTable('OperationNotification');
     // Создать услугу с захардкоженным ID
     $service = new Service();
     $service->setKeyword(Service::SERVICE_SMS);
     $service->save();
 }
開發者ID:ru-easyfinance,項目名稱:EasyFinance,代碼行數:11,代碼來源:OperationNotificationTableTest.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /services
  *
  * @return Response
  */
 public function store()
 {
     $service = new Service();
     $service->service = Input::get('service');
     $service->save();
     Flash::message('Service Added!');
     return Redirect::route('add_service');
 }
開發者ID:BobbyHoltzner,項目名稱:Laravel4CRM,代碼行數:14,代碼來源:ServicesController.php

示例8: testIndex

 /**
  * Тест /services/index
  *
  */
 public function testIndex()
 {
     $user = $this->helper->makeUser();
     $this->authenticateUser($user);
     $user->save();
     $service = new Service();
     $service->price = 100;
     $service->name = "Уникальное имя услуги " . uniqid();
     $service->save();
     $this->browser->get($this->generateUrl('services'))->with('response')->begin()->isStatusCode(200)->matches('/(' . $service->name . ')/i')->end();
 }
開發者ID:ru-easyfinance,項目名稱:EasyFinance,代碼行數:15,代碼來源:servicesActionsTest.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('cs_service_types')->delete();
     $services = array("Theme", "Project", "Fix Bug");
     foreach ($services as $service) {
         $sv = new Service();
         $sv->name = $service;
         $sv->description = "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
         $sv->save();
     }
 }
開發者ID:vnzacky,項目名稱:exp_services,代碼行數:16,代碼來源:ServiceTypeSeeder.php

示例10: storeService

 public function storeService()
 {
     $advisor = Auth::user();
     // If form validation passes:
     $service = new Service();
     $service->name = Input::get('name');
     if (Input::get('notes')) {
         $service->notes = Input::get('notes');
     }
     $service->save();
     $advisor->services()->save($service);
     return Redirect::intended('advisor.dashboard');
 }
開發者ID:hvent90,項目名稱:service-booker,代碼行數:13,代碼來源:RegistrationController.php

示例11: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Service();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Service'])) {
         $model->attributes = $_POST['Service'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:frankpaul142,項目名稱:hospital-metropolitano,代碼行數:17,代碼來源:ServiceController.php

示例12: submit

 public function submit()
 {
     $facility1 = $this->input->post('spoint');
     $service = $this->input->post('facility');
     $u = new Service();
     $u->facility_id = $service;
     $u->service_point = $facility1;
     $u->save();
     $data['title'] = "Service Points";
     $data['content_view'] = "facility_service";
     $data['banner_text'] = "Service Points";
     $data['quick_link'] = "facility_service";
     $this->load->view("template", $data);
 }
開發者ID:HCMPKenya,項目名稱:HCMP-ALPHA,代碼行數:14,代碼來源:service_point.php

示例13: install

 /**	install($name)
 		Method that installs the relevant plugin.
 
 		$name just sends the plugin name.  Useful
 		for schema adding.
 	*/
 public function install($name)
 {
     $sql = "CREATE TABLE capone\n        (cID INTEGER NOT NULL AUTO_INCREMENT,\n        cImageID INTEGER NOT NULL,\n        cOSID INTEGER NOT NULL,\n        cKey VARCHAR(250) NOT NULL,\n        PRIMARY KEY(cID),\n        INDEX new_index (cImageID),\n        INDEX new_index2 (cKey))\n        ENGINE = MyISAM";
     if ($this->DB->query($sql)) {
         $CaponeDMI = new Service(array('name' => 'FOG_PLUGIN_CAPONE_DMI', 'description' => 'This setting is used for the capone module to set the DMI field used.', 'value' => '', 'category' => 'Plugin: ' . $name));
         $CaponeDMI->save();
         $CaponeRegEx = new Service(array('name' => 'FOG_PLUGIN_CAPONE_REGEX', 'description' => 'This setting is used for the capone module to set the reg ex used.', 'value' => '', 'category' => 'Plugin: ' . $name));
         $CaponeRegEx->save();
         $CaponeShutdown = new Service(array('name' => 'FOG_PLUGIN_CAPONE_SHUTDOWN', 'description' => 'This setting is used for the capone module to set the shutdown after imaging.', 'value' => '', 'category' => 'Plugin: ' . $name));
         $CaponeShutdown->save();
         return true;
     }
     return false;
 }
開發者ID:bramverstraten,項目名稱:fogproject,代碼行數:20,代碼來源:CaponeManager.class.php

示例14: createService

 /**
  * Creates a new service and returns the service Object.
  * @return [type] [description]
  */
 public function createService($name, $notes, $duration, $id = null)
 {
     $advisor = Advisor::find($id);
     $service = new Service();
     $service->name = $name;
     $service->duration = $duration;
     $service->notes = $notes;
     $service->save();
     if ($id == null) {
         return $service;
     }
     $advisor->services()->attach($service);
     return $service;
 }
開發者ID:hvent90,項目名稱:service-booker,代碼行數:18,代碼來源:Service.php

示例15: saveService

 public function saveService()
 {
     $service = ['name' => Input::get('name')];
     $rules = ['name' => 'required'];
     $valid = Validator::make($service, $rules);
     if ($valid->passes()) {
         $service = new Service($service);
         $service->save();
         if (!empty(Input::get('pets'))) {
             $service->pets()->sync(Input::get('pets'));
         }
         return Redirect::to('/services')->with('success', 'Service is saved!');
     } else {
         return Redirect::back()->withErrors($valid)->withInput();
     }
 }
開發者ID:phpgraduate,項目名稱:laravel-petshop,代碼行數:16,代碼來源:ServicesController.php


注:本文中的Service::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。