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


PHP Bank::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /debtors
  *
  * @return Response
  */
 public function store()
 {
     $contact = new Contact();
     $contact->name = Input::get('contact_person');
     $contact->email = Input::get('email');
     $contact->phone = Input::get('phone');
     $contact->mobile = Input::get('mobile');
     $contact->web = Input::get('web');
     $contact->fax = Input::get('fax');
     $contact->save();
     $contact_id = $contact->id;
     $company = new Company();
     $company->name = Input::get('company_name');
     $company->contact_id = $contact_id;
     $company->address = Input::get('address');
     $company->postal_code = Input::get('postal_code');
     $company->city = Input::get('city');
     $company->country = Input::get('country');
     $company->vat = Input::get('vat');
     $company->coc = Input::get('coc');
     $company->save();
     $company_id = $company->id;
     //Billing
     $contact_billing = new Contact();
     $contact_billing->name = Input::get('billing_contact_person');
     $contact_billing->billing = 'true';
     $contact_billing->save();
     $contact_billing_id = $contact_billing->id;
     $company_billing = new Company();
     $company_billing->name = Input::get('billing_company_name');
     $company_billing->contact_id = $contact_billing_id;
     $company_billing->address = Input::get('billing_address');
     $company_billing->postal_code = Input::get('billing_postal_code');
     $company_billing->city = Input::get('billing_city');
     $company_billing->country = Input::get('billing_country');
     $contact_billing->billing = 'true';
     $company_billing->save();
     $company_billing_id = $contact_billing->id;
     $bank = new Bank();
     $bank->name = Input::get('bank');
     $bank->bic = Input::get('bic');
     $bank->save();
     $bank_id = $bank->id;
     $account = new Account();
     $account->iban = Input::get('iban');
     $account->name = Input::get('account_name');
     $account->bank_id = $bank_id;
     $account->save();
     $account_id = $account->id;
     //Debtor Save
     $debtor = new Debtor();
     $debtor->no = Input::get('debtor_number');
     $debtor->legal = Input::get('legal');
     $debtor->company_id = $company_id;
     $debtor->billing_company_id = $company_billing_id;
     $debtor->account_id = $account_id;
     $debtor->group_id = Input::get('group');
     $debtor->save();
     return $this->index();
 }
开发者ID:BQumobile,项目名称:simple-invoicing-system,代码行数:66,代码来源:DebtorsController.php

示例2: _createNewBank

 protected function _createNewBank($bank)
 {
     $model = new Bank();
     $model->title = $bank['title'];
     $model->position = $bank['pos'];
     $model->license = $bank['license'];
     $model->save();
 }
开发者ID:ZyManch,项目名称:zbank,代码行数:8,代码来源:BankCommand.php

示例3: store

 /**
  * Store a newly created resource in storage.
  * POST /banks
  *
  * @return Response
  */
 public function store($companies)
 {
     $name = Input::get('name');
     $bank = new Bank();
     $bank->name = $name;
     $bank->company_id = $companies;
     $bank->save();
     return $bank;
 }
开发者ID:hilmysyarif,项目名称:erp,代码行数:15,代码来源:BanksController.php

示例4: actionCreate

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

示例5: store

 /**
  * Store a newly created branch in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Bank::$rules, Bank::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $bank = new Bank();
     $bank->bank_name = Input::get('name');
     $bank->organization_id = '1';
     $bank->save();
     return Redirect::route('banks.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:17,代码来源:BanksController.php

示例6: save

 public function save()
 {
     foreach ($this->banks as $key => $bankInfo) {
         $bank = False;
         $bankResource = BankResources::model()->getBankResource($this->sourceType, $key)->find();
         if ($bankResource) {
             $bank = Bank::model()->findByPk($bankResource->bank_id);
         }
         if (!$bank) {
             $bank = new Bank();
         }
         foreach ($bankInfo as $sum => $info) {
             if (!$bank->id) {
                 //                    $bank->phone = $info['info']['tel'];
                 $bank->address = $info['info']['address'];
                 $bank->name = $info['name'];
                 $bank->save();
                 $bankResource = new BankResources();
                 $bankResource->bank_id = $bank->id;
                 $bankResource->source_id = $this->sourceType;
                 $bankResource->source_alias = $key;
                 $bankResource->save();
                 $newBranch = new BankBranches();
                 $newBranch->address = $info['info']['address'];
                 $yandexGeoDecode = @file_get_contents('http://geocode-maps.yandex.ru/1.x/?format=json&results=1&geocode=город Москва, ' . $newBranch->address);
                 if ($yandexGeoDecode) {
                     $answer = json_decode($yandexGeoDecode, True);
                     if (!isset($answer['response']) && count($answer['response']['GeoObjectCollection']['featureMember']) == 0) {
                         continue;
                     }
                     $pos = $answer['response']['GeoObjectCollection']['featureMember'][0]['GeoObject']['Point']['pos'];
                     $pos = explode(' ', $pos);
                     $newBranch->latitude = $pos[1];
                     $newBranch->longtitude = $pos[0];
                     $newBranch->preparePhone($info['info']['tel']);
                     $newBranch->save();
                     $newBranch->bank_id = $bank->id;
                     $newBranch->save();
                 }
             }
             if ($bank->id) {
                 $cur = new BankCourses();
                 $cur->bank_id = $bank->id;
                 $cur->buy = $info['pok'];
                 $cur->sale = $info['prod'];
                 $cur->sum = $sum;
                 $cur->currency = $this->siteCurrencyType;
                 $cur->save();
             }
         }
     }
 }
开发者ID:EkaterinaAlekseenko,项目名称:kursoid,代码行数:52,代码来源:RbcParser.php

示例7: updatebank

 private function updatebank($client, $grid, $tt = 1)
 {
     $it = TmpXml::model()->findAll("ctype=:ctype AND ckey=:ckey AND user=:user", array(':ctype' => $tt == 1 ? 12 : 13, ':ckey' => $client, ':user' => Yii::app()->user->uid));
     if (!($it === null)) {
         $new_bank = false;
         $bank_ps = array();
         foreach ($it as $valu) {
             if ($valu->cname == 'id') {
                 $bank_id = $valu->lname;
                 $bank = Bank::model()->find("longname=:longname", array(':longname' => $bank_id));
                 if ($bank === null) {
                     $new_bank = true;
                     $bank = new Bank();
                     $bank->type_id = $tt;
                     $bank->department_id = $grid;
                     $bank->longname = $bank_id;
                     $bank->name = $bank_id;
                     $bank->save();
                 }
             } elseif ($valu->cname == 'host') {
             } else {
                 $bank_ps[$valu->cname] = $valu->lname;
             }
         }
         if ($new_bank) {
             foreach ($bank_ps as $key => $valu) {
                 $prop = new BankProp();
                 $prop->id = $bank->id;
                 $prop->_key = $key;
                 $prop->_value = $valu;
                 $prop->save();
             }
         } else {
             foreach ($bank_ps as $key => $valu) {
                 if (!($prop = BankProp::model()->findByPk(array('id' => $bank->id, '_key' => $key)))) {
                     $prop = new BankProp();
                 }
                 $prop->id = $bank->id;
                 $prop->_key = $key;
                 $prop->_value = $valu;
                 $prop->save();
             }
         }
     }
 }
开发者ID:emisdb,项目名称:tffin,代码行数:45,代码来源:TmpXmlController.php

示例8: run

 public function run($args)
 {
     $mem_start = memory_get_usage();
     $url = 'http://www.banki.ru/api/';
     $data = array('id' => '1', 'method' => 'bankInfo/getBankList', 'jsonrpc' => '2.0', 'params' => array('region_id' => array(4), 'show_on_banki' => array(0, 1, 2)));
     $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => json_encode($data)));
     $context = stream_context_create($options);
     $result = file_get_contents($url, false, $context);
     $banks = json_decode($result, True);
     if (isset($banks['error'])) {
         print $banks['error'];
         die;
     }
     $banksData = array();
     $bankNewId = array();
     foreach ($banks['result']['data'] as $bankInfo) {
         switch ($bankInfo['region']) {
             case 'Москва':
                 $source_bank_id = $bankInfo['bank_id'];
                 $bank = Bank::model()->getBankResource(Yii::app()->params['sourceId']['bankiRu'], $source_bank_id)->find();
                 if (!$bank) {
                     $bank = new Bank();
                     $bank->name = $bankInfo['bank_name'];
                     $bank->source_id = Yii::app()->params['sourceId']['bankiRu'];
                     $bank->source_alias = $source_bank_id;
                     $bank->save();
                 }
                 $bankNewId[$source_bank_id] = $bank->id;
                 $banksData[$bank->id] = $bank;
                 break;
             default:
                 break;
         }
     }
     $data = array('id' => '2', 'method' => 'bankGeo/getObjectsByFilter', 'jsonrpc' => '2.0', 'params' => array('bank_id' => array_keys($bankNewId), 'limit' => 100000000, 'region_id' => array(4), 'type' => array('office', 'branch', 'cash'), 'with_empty_coordinates' => true));
     $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => json_encode($data)));
     $context = stream_context_create($options);
     $result = file_get_contents($url, false, $context);
     $branchData = json_decode($result, True);
     if (isset($branchData['error'])) {
         print_r($branchData['error']);
         die;
     }
     foreach ($branchData['result']['data'] as $branch) {
         $newBranch = BankBranches::model()->getBranchesResource(Yii::app()->params['sourceId']['bankiRu'], $branch['id'])->find();
         if (!$newBranch) {
             $newBranch = new BankBranches();
             $newBranch->address = $branch['address'];
             $data = array('id' => '3', 'method' => 'bank/getBankObjectsData', 'jsonrpc' => '2.0', 'params' => array('id_list' => array($branch['id'])));
             $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => json_encode($data)));
             $context = stream_context_create($options);
             $result = json_decode(file_get_contents($url, false, $context), true);
             $newBranch->latitude = $branch['latitude'];
             $newBranch->longtitude = $branch['longitude'];
             $newBranch->bank_id = $bankNewId[$branch['bank_id']];
             if (!isset($result['error'])) {
                 $ph = $newBranch->preparePhone($result['result']['data'][0]['phone']);
                 if ($result['result']['data'][0]['is_main_office'] == 1) {
                     if (isset($banksData[$bankNewId[$branch['bank_id']]])) {
                         $b = $banksData[$bankNewId[$branch['bank_id']]];
                         $b->phone = $ph;
                         $b->save();
                     }
                 }
             }
             $newBranch->save();
         }
     }
     echo memory_get_usage() - $mem_start;
 }
开发者ID:EkaterinaAlekseenko,项目名称:kursoid,代码行数:70,代码来源:BanksGetParserCommand.php

示例9: function

});
/* #################### IMPORT BANKS ################################## */
Route::post('import/banks', function () {
    if (Input::hasFile('banks')) {
        $destination = public_path() . '/migrations/';
        $filename = str_random(12);
        $ext = Input::file('banks')->getClientOriginalExtension();
        $file = $filename . '.' . $ext;
        Input::file('banks')->move($destination, $file);
        Excel::selectSheetsByIndex(0)->load(public_path() . '/migrations/' . $file, function ($reader) {
            $results = $reader->get();
            foreach ($results as $result) {
                $bank = new Bank();
                $bank->bank_name = $result->bank_name;
                $bank->organization_id = $result->organization_id;
                $bank->save();
            }
        });
    }
    return Redirect::back()->with('notice', 'banks have been succefully imported');
});
/*
* #####################################################################################################################
*/
/*
* banks routes
*/
Route::resource('banks', 'BanksController');
Route::post('banks/update/{id}', 'BanksController@update');
Route::get('banks/delete/{id}', 'BanksController@destroy');
Route::get('banks/edit/{id}', 'BanksController@edit');
开发者ID:kenkode,项目名称:xpose,代码行数:31,代码来源:routes.php

示例10: actionUpload

 public function actionUpload()
 {
     parent::actionUpload();
     $folder = $_SERVER['DOCUMENT_ROOT'] . Yii::app()->request->baseUrl . '/upload/';
     // folder for uploaded files
     $file = $folder . basename($_FILES['uploadfile']['name']);
     if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
         $row = 0;
         if (($handle = fopen($file, "r")) !== FALSE) {
             while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                 if ($row > 0) {
                     $model = Bank::model()->findByPk((int) $data[0]);
                     if ($model === null) {
                         $model = new Bank();
                     }
                     $model->addressbookid = (int) $data[0];
                     $model->fullname = $data[1];
                     $model->isbank = 1;
                     $model->recordstatus = (int) $data[2];
                     try {
                         if (!$model->save()) {
                             $this->messages = $this->messages . Catalogsys::model()->getcatalog(' upload error at ' . $data[0]);
                         }
                     } catch (Exception $e) {
                         $this->messages = $this->messages . $e->getMessage();
                     }
                 }
                 $row++;
             }
         } else {
             $this->messages = $this->messages . ' memory or harddisk full';
         }
         fclose($handle);
     } else {
         $this->messages = $this->messages . ' check your directory permission';
     }
     if ($this->messages == '') {
         $this->messages = 'success';
     }
     echo $this->messages;
 }
开发者ID:bylinggha,项目名称:Capella-ERP-Indonesia,代码行数:41,代码来源:BankController.php


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