本文整理汇总了PHP中Provider::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Provider::save方法的具体用法?PHP Provider::save怎么用?PHP Provider::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Provider
的用法示例。
在下文中一共展示了Provider::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Provider();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Provider'])) {
$model->attributes = $_POST['Provider'];
if ($model->save()) {
$this->redirect(array('admin'));
}
}
$this->render('create', array('model' => $model));
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$provider = new Provider();
$data = Input::all();
// Revisamos si la data es válido
if ($provider->isValid($data)) {
// Si la data es valida se la asignamos al provider
$provider->fill($data);
// Guardamos el provider
$provider->save();
return Redirect::to('admin/provider')->with('success_message', 'El registro ha sido ingresado correctamente.')->withInput();
} else {
// En caso de error regresa a la acción create con los datos y los errores encontrados
return Redirect::back()->withInput()->withErrors($provider->errors);
}
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Provider();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Provider'])) {
$model->attributes = $_POST['Provider'];
//$model->active = 1;
if ($model->save()) {
if (!empty($_POST['yt1'])) {
Yii::app()->user->setFlash('provider-created', "¡El proveedor <b><i>"{$model->name}"</i></b> fue creado exitosamente!");
$this->redirect(array('create'));
} else {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('create', array('model' => $model));
}
示例4: saveProvider
protected function saveProvider($user = null, $service = null)
{
if ($user and $service) {
$provider = new Provider();
$provider->user_id = $user->id;
$provider->industry_id = $service->industry_id;
$provider->loc_id = $user->details->loc_id;
$provider->legal_form = 'freelancer';
$provider->type = 'service_provider';
$provider->department_type = 'hq';
$provider->status = 'active';
$provider->registration_time = date('Y-m-d H:i:s');
if ($provider->save()) {
$user->is_provider = 1;
$user->save();
// provider Contact
$providerContact = new \common\models\ProviderContact();
$providerContact->provider_id = $provider->id;
$providerContact->contact_type = 'e-mail';
$providerContact->value = $user->email;
$providerContact->save();
// provider Industry
$providerIndustry = new \common\models\ProviderIndustries();
$providerIndustry->provider_id = $provider->id;
$providerIndustry->industry_id = $service->industry_id;
$providerIndustry->main = 1;
if ($providerIndustry->save()) {
$proserv = new \common\models\ProviderServices();
$proserv->provider_industry_id = $providerIndustry->id;
$proserv->provider_id = $provider->id;
$proserv->industry_id = $service->industry_id;
$proserv->service_id = $service->id;
$proserv->is_set = 1;
$proserv->update_time = date('Y-m-d H:i:s');
$proserv->save();
}
// provider Industry Terms
$providerIndustryTerm = new \common\models\ProviderIndustryTerms();
$providerIndustryTerm->provider_industry_id = $providerIndustry->id;
$providerIndustryTerm->update_time = date('Y-m-d H:i:s');
$providerIndustryTerm->save();
// provider Language
$providerLanguage = new \common\models\ProviderLanguages();
$providerLanguage->provider_id = $provider->id;
$providerLanguage->lang_code = 'SR';
$providerLanguage->save();
// provider Portfolio
$providerPortfolio = new \common\models\ProviderPortfolio();
$providerPortfolio->provider_id = $provider->id;
$providerPortfolio->name = 'Moj portfolio';
$providerPortfolio->save();
// provider Terms
$providerTerms = new \common\models\ProviderTerms();
$providerTerms->provider_id = $provider->id;
$providerTerms->update_time = date('Y-m-d H:i:s');
$providerTerms->save();
// provider Notifications
$providerNotifications = new \common\models\ProviderNotifications();
$providerNotifications->provider_id = $provider->id;
$providerNotifications->notification_type = 'matching';
$providerNotifications->time = date('Y-m-d H:i:s');
$providerNotifications->save();
return $proserv;
}
}
return false;
}
示例5: foreach
foreach ($license->getConsortiumList() as $display) {
if ($_GET['shortName'] == $display['name']) {
echo "<option value='" . $display['consortiumID'] . "' selected>" . $display['name'] . "</option>";
} else {
echo "<option value='" . $display['consortiumID'] . "'>" . $display['name'] . "</option>";
}
}
echo "</select>";
break;
case 'addProvider':
if (isset($_GET['shortName']) && $_GET['shortName'] != '') {
$provider = new Provider();
$provider->providerID = '';
$provider->shortName = $_GET['shortName'];
try {
$provider->save();
} catch (Exception $e) {
echo $e->getMessage();
}
}
echo "<select name='licenseProviderID' id='licenseProviderID'>";
echo "<option value=''></option>";
$displayArray = array();
$display = array();
$provider = new Provider();
$displayArray = $provider->allAsArray();
foreach ($displayArray as $display) {
if ($_GET['shortName'] == $display['shortName']) {
echo "<option value='" . $display['providerID'] . "' selected>" . $display['shortName'] . "</option>";
} else {
echo "<option value='" . $display['providerID'] . "'>" . $display['shortName'] . "</option>";
示例6: actionImport
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionImport()
{
$model = new Provider();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Provider'])) {
if (!empty($_FILES)) {
$tempFile = $_FILES['Provider']['tmp_name']['fileImport'];
$fileTypes = array('xls', 'xlsx');
// File extensions
$fileParts = pathinfo($_FILES['Provider']['name']['fileImport']);
if (in_array(@$fileParts['extension'], $fileTypes)) {
Yii::import('ext.heart.excel.EHeartExcel', true);
EHeartExcel::init();
$inputFileType = PHPExcel_IOFactory::identify($tempFile);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($tempFile);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
$baseRow = 2;
$inserted = 0;
$read_status = false;
while (!empty($sheetData[$baseRow]['A'])) {
$read_status = true;
//$provider_id= $sheetData[$baseRow]['A'];
$name = $sheetData[$baseRow]['B'];
$model2 = new Provider();
//$model2->provider_id= $provider_id;
$model2->name = $name;
try {
if ($model2->save()) {
$inserted++;
}
} catch (Exception $e) {
Yii::app()->user->setFlash('error', "{$e->getMessage()}");
//$this->refresh();
}
$baseRow++;
}
Yii::app()->user->setFlash('success', $inserted . ' row inserted');
} else {
Yii::app()->user->setFlash('warning', 'Wrong file type (xlsx, xls, and ods only)');
}
}
$this->render('admin', array('model' => $model));
} else {
$this->render('admin', array('model' => $model));
}
}
示例7: actionRegisterProvider
public function actionRegisterProvider()
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
$request = Yii::app()->request;
try {
$name = $request->getPost('name');
$email = $request->getPost('email');
$phone = $request->getPost('phone');
$address = $request->getPost('address');
$provider = new Provider();
$provider->email = $email;
$provider->phone = $phone;
$provider->provider_name = $name;
$provider->provider_address = $address;
$token = StringHelper::generateToken(5, 25);
$provider->token = $token;
if ($provider->save(FALSE)) {
$subject = 'Kích hoạt tài khoản provider Meboo của bạn';
$to_email = $email;
$from_email = 'hotro@meboo.vn';
$from_name = 'Hỗ trợ Meboo';
$message = 'Bấm vào đây để kích hoạt tài khoản Provider Meboo của bạn: http://doitac.meboo.vn/user/activate?token=' . $token;
MailQueue::model()->addMailQueue($message, $from_email, $from_name, $to_email, $subject);
ResponseHelper::JsonReturnSuccess('', 'Success');
} else {
ResponseHelper::JsonReturnError('', 'Error');
}
} catch (Exception $ex) {
ResponseHelper::JsonReturnError($ex->getMessage(), 'Error');
}
}
示例8: add
public function add($post)
{
$model = new Provider();
$model->setAttributes($post);
$model->active = 0;
//MailQueue::model()->add();
if ($model->save(FALSE)) {
MailQueue::model()->addMailQueue('Có một đơn vị cung cấp dịch vụ y tế đã đăng ký tới Meboo', 'hotro@meboo.vn', 'meboo admin', 'huynt57@gmail.com', 'Có một đơn đặt hàng mới dịch vụ medlatec');
return TRUE;
}
return FALSE;
}