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


PHP Company::find方法代码示例

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


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

示例1: actionCompany

 public function actionCompany()
 {
     $company = Company::find()->one();
     if (empty($company)) {
         $company = new Company();
         $company->vat = 0;
         $company->logo = '';
     }
     $post = Yii::$app->request->post();
     if (!empty($post)) {
         if (!empty($_FILES['Company']['name']['logo'])) {
             $tmp_name = $_FILES['Company']['tmp_name']['logo'];
             $name = $_FILES['Company']['name']['logo'];
             if (file_exists('upload/' . $name)) {
                 unlink('upload' . $name);
             }
             if (move_uploaded_file($tmp_name, 'upload/' . $name)) {
                 $company->logo = $name;
             }
         }
         $company->name = $post['Company']['name'];
         $company->tax_code = $post['Company']['tax_code'];
         $company->tel = $post['Company']['tel'];
         $company->website = $post['Company']['website'];
         $company->address = $post['Company']['address'];
         $company->vat = $post['Company']['vat'];
         if ($company->save()) {
             $session = new Session();
             $session->setFlash('message', 'บันทึกรายการแล้ว');
             return $this->redirect(['company']);
         }
     }
     return $this->render('//config/company', ['company' => $company]);
 }
开发者ID:kaniou,项目名称:yii2pos,代码行数:34,代码来源:ConfigController.php

示例2: getCompaniesLogo

 private function getCompaniesLogo()
 {
     $organisators = Company::find()->where(['is_organisator' => '1'])->orderBy('order')->all();
     $organisatorsAndMembers = [];
     foreach ($organisators as $value) {
         $organisatorsAndMembers[$value->attributes['id']]['name'] = $value->attributes['name'];
         if ($value->attributes['logo_url'] != '') {
             $organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . $value->attributes['logo_url'];
         } else {
             $organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . '/files/logo/no_logo.jpg';
         }
         $organisatorsAndMembers[$value->attributes['id']]['intro'] = $value->attributes['intro_' . Yii::$app->language];
         $organisatorsAndMembers[$value->attributes['id']]['site'] = $value->attributes['site'];
     }
     $members = Company::find()->where(['is_sponsor' => '1'])->orderBy('order')->all();
     foreach ($members as $value) {
         $organisatorsAndMembers[$value->attributes['id']]['name'] = $value->attributes['name'];
         if ($value->attributes['logo_url'] != '') {
             $organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . $value->attributes['logo_url'];
         } else {
             $organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . '/files/logo/no_logo.jpg';
         }
         $organisatorsAndMembers[$value->attributes['id']]['intro'] = $value->attributes['intro_' . Yii::$app->language];
         $organisatorsAndMembers[$value->attributes['id']]['site'] = $value->attributes['site'];
     }
     return $organisatorsAndMembers;
 }
开发者ID:unix-admin,项目名称:profitday,代码行数:27,代码来源:LogoWidget.php

示例3: actionIndex

 public function actionIndex()
 {
     $query = Company::find();
     //var_dump($query);die;
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $row = $query->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->renderPartial('index', ['data' => $row, 'pagination' => $pagination]);
 }
开发者ID:Greasi,项目名称:yizuniuke,代码行数:8,代码来源:CompanyController.php

示例4: up

 public function up()
 {
     $companys = Company::find()->All();
     foreach ($companys as $company) {
         //update payment,config
         $this->insert($company->prefix . 'paymentType', ['id' => 8, 'name' => 'PayPal', 'value' => '\\app\\components\\payments\\Cash', 'oppt_account_id' => 12]);
         $this->insert($company->prefix . 'accounts', ["id" => 12, "type" => 4, 'name' => 'PayPal', 'src_tax' => 0]);
         $this->update($company->prefix . 'files', ['parent_type' => '\\app\\models\\docs'], ['parent_type' => "Docs"]);
         $this->update($company->prefix . 'files', ['parent_type' => '\\app\\models\\Accounts'], ['parent_type' => "Accounts"]);
     }
     return true;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:12,代码来源:m150430_162555_paypal.php

示例5: edit

 public function edit($id)
 {
     if (Auth::user()->can('update-equipment')) {
         $data['equipment'] = Equipment::find($id);
         $data['title'] = $data['equipment']->company->name . " - Equipment " . $data['equipment']->name;
         $data['equipment_types'] = EquipmentType::orderBy("name")->get();
         $data['company'] = Company::find($data['equipment']->company_id);
         $data['company']->company_id = $data['company']->id;
         return view('equipment/edit', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to equipment edit page']);
     }
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:13,代码来源:EquipmentController.php

示例6: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'companyname', $this->companyname])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'contact', $this->contact])->andFilterWhere(['like', 'taxation_number', $this->taxation_number]);
     return $dataProvider;
 }
开发者ID:kimniyom,项目名称:transport,代码行数:21,代码来源:CompanySearch.php

示例7: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
开发者ID:sudaswani,项目名称:sudaswani-apc-softdev-gd121mi122-07,代码行数:21,代码来源:CompanySearch.php

示例8: up

 public function up()
 {
     $companys = Company::find()->All();
     foreach ($companys as $company) {
         //update payment,config
         $table = Yii::$app->db->schema->getTableSchema($company->prefix . 'accHist');
         if (!isset($table->columns['subject'])) {
             $this->addColumn($company->prefix . 'accHist', 'subject', 'VARCHAR(255)');
             $this->addColumn($company->prefix . 'accHist', 'status', 'INTEGER(11)');
             $this->addColumn($company->prefix . 'accHist', 'type', 'INTEGER(11)');
         }
     }
     return true;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:14,代码来源:m150705_105014_crm.php

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'uid' => Yii::$app->user->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'addr', $this->addr]);
     return $dataProvider;
 }
开发者ID:vbboy2012,项目名称:1861886,代码行数:21,代码来源:CompanySearch.php

示例10: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'need_presentation' => $this->need_presentation, 'need_training' => $this->need_training, 'pay_agree' => $this->pay_agree, 'is_organisator' => $this->is_organisator, 'is_sponsor' => $this->is_sponsor, 'order' => $this->order]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ideas', $this->ideas])->andFilterWhere(['like', 'contact_person', $this->contact_person])->andFilterWhere(['like', 'telephone', $this->telephone])->andFilterWhere(['like', 'e_mail', $this->e_mail])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'logo_url', $this->logo_url])->andFilterWhere(['like', 'intro_uk', $this->intro_uk])->andFilterWhere(['like', 'intro_ru', $this->intro_ru])->andFilterWhere(['like', 'intro_en', $this->intro_en])->andFilterWhere(['like', 'facebook_profile', $this->facebook_profile])->andFilterWhere(['like', 'google_profile', $this->google_profile])->andFilterWhere(['like', 'linkedin_profile', $this->linkedin_profile])->andFilterWhere(['like', 'vk_profile', $this->vk_profile]);
     return $dataProvider;
 }
开发者ID:unix-admin,项目名称:profitday,代码行数:21,代码来源:SearchCompany.php

示例11: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'pricipal_id' => $this->pricipal_id]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'addr', $this->addr])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'comment', $this->comment]);
     return $dataProvider;
 }
开发者ID:stknight43,项目名称:SHBB,代码行数:21,代码来源:CompanySearch.php

示例12: actionGetCard

 public function actionGetCard($cid)
 {
     $company = Company::find()->where(['id' => $cid])->asArray()->one();
     $address = Address::find()->where(['id' => $company['address_id']])->asArray()->one();
     $shedule = Shedule::find()->where(['company_id' => $cid])->asArray()->all();
     $brand = Company::find()->where(['id' => $cid])->one()->brand;
     $service = Company::find()->where(['id' => $cid])->one()->service;
     $srv = ArrayHelper::getColumn($service, 'category_id');
     $category = Category::find()->where(['id' => $srv])->asArray()->indexBy('id')->all();
     $srv = ArrayHelper::map($service, 'id', 'name', 'category_id');
     $spoffer = SpecialOffer::find()->where(['company_id' => $cid])->asArray()->one();
     $file = Files::find()->where(['id' => $spoffer['file_id']])->asArray()->one();
     Yii::$app->response->format = Response::FORMAT_JSON;
     $response = ['company' => $company, 'address' => $address, 'shedule' => $shedule, 'brand' => $brand, 'category' => $category, 'service' => $srv, 'spoffer' => $spoffer, 'file' => $file];
     return $response;
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:16,代码来源:CompanyController.php

示例13: edit_submit

 public function edit_submit()
 {
     $data = \Request::all();
     $company = Company::find(\Request::input('company_id'));
     $company->name = $data['name'];
     if (isset($data['image'])) {
         $file_name = \Common::get_img_filename($data['image']);
         \Common::make_square_img($file_name, 140);
         $res = \Common::s3_upload($file_name, 'company/');
         if ($res['success']) {
             $company->ci = $res['filename'];
         }
     }
     $company->status = $data['status_group'];
     $company->save();
     return \Redirect()->action('CompanyController@index');
 }
开发者ID:comsi02,项目名称:ordermart,代码行数:17,代码来源:CompanyController.php

示例14: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $admin_id = Yii::$app->user->identity->id;
     $query = Company::find();
     if (Yii::$app->user->identity->type == 'normal') {
         $query = $query->innerJoin('wolf_admin_to_company wc', 'wc.company_id=wolf_company.company_id');
         $query = $query->where('admin_id=' . $admin_id);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['company_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['company_id' => $this->company_id]);
     $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_email', $this->company_email])->andFilterWhere(['like', 'company_contact', $this->company_contact])->andFilterWhere(['like', 'company_address', $this->company_address])->andFilterWhere(['like', 'account_no', $this->account_no])->andFilterWhere(['like', 'payment_terms', $this->payment_terms])->andFilterWhere(['like', 'rate', $this->rate])->andFilterWhere(['like', 'person_in_charge', $this->person_in_charge]);
     return $dataProvider;
 }
开发者ID:sindotnet,项目名称:cona,代码行数:26,代码来源:CompanySearch.php

示例15: actionIndex

 public function actionIndex()
 {
     $company = Company::find()->orderBy('id')->one();
     if (!empty($_POST)) {
         if (!empty($_FILES['Company'])) {
             // remove old logo
             if (!empty($company->logo)) {
                 $old_img = $company->logo;
                 unlink('../uploads/' . $old_img);
             }
             // upload new logo
             $img = $_FILES['Company']['name']['logo'];
             $ext = end(explode(".", $img));
             $name = microtime();
             $name = str_replace(' ', '', $name);
             $name = str_replace('.', '', $name);
             $name = $name . '.' . $ext;
             $tmp = $_FILES['Company']['tmp_name']['logo'];
             $company->logo = $name;
             move_uploaded_file($tmp, '../uploads/' . $name);
         }
         $company->name = $_POST['Company']['name'];
         $company->web_title = $_POST['Company']['web_title'];
         $company->tel = $_POST['Company']['tel'];
         $company->email = $_POST['Company']['email'];
         $company->fax = $_POST['Company']['fax'];
         $company->website = $_POST['Company']['website'];
         $company->facebook = $_POST['Company']['facebook'];
         $company->line_id = $_POST['Company']['line_id'];
         $company->address = $_POST['Company']['address'];
         $company->tax_code = $_POST['Company']['tax_code'];
         $company->payment = $_POST['Company']['payment'];
         $company->about = $_POST['Company']['about'];
         if ($company->save()) {
             $session = new Session();
             $session->open();
             $session->setFlash('message', 'Data Saved.');
             return $this->redirect(['index']);
         }
     }
     return $this->render('//Company/Index', ['company' => $company]);
 }
开发者ID:pichai2514,项目名称:gov_book2016,代码行数:42,代码来源:CompanyController.php


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