本文整理汇总了PHP中app\models\Company::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::select方法的具体用法?PHP Company::select怎么用?PHP Company::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query()
{
$params['order'] = isset($params['order']) ? $params['order'] : ['name|ASC'];
$companies = Company::select("companies.*");
$companies->leftJoin("company_main_contacts", "companies.id", "=", "company_main_contacts.company_id");
$companies->leftJoin("company_person as company_person_main_contacts", "company_person_main_contacts.id", "=", "company_main_contacts.main_contact_id");
$companies->leftJoin("company_account_managers", "companies.id", "=", "company_account_managers.company_id");
$companies->leftJoin("company_person as company_person_account_managers", "company_person_account_managers.id", "=", "company_account_managers.account_manager_id");
$companies->leftJoin("people as account_managers", "company_person_account_managers.person_id", "=", "account_managers.id");
$companies->leftJoin("people as main_contacts", "company_person_main_contacts.person_id", "=", "main_contacts.id");
if (!Auth::user()->active_contact->isE80()) {
$companies->where("companies.id", "=", Auth::user()->active_contact->company_id);
}
return $companies;
}
示例2: actionOpenfrmtimport
public function actionOpenfrmtimport()
{
$model = new FormOpenfrmt();
if (isset($_POST['SwitchType'])) {
//save current
//$corComp=Yii::$app->user->Database->id;
$newComp = (int) $_POST['companyId'];
//company load
Company::select($newComp);
foreach ($_POST['SwitchType'] as $old => $new) {
\app\models\Acctype::switchType($old, $new);
}
//end
//$this->redirect(\yii\helpers\BaseUrl::base() . '/company/index');
}
if (isset($_POST['FormOpenfrmt'])) {
//$yiiUser=Yii::$app->user->id;
//$configPath=\app\helpers\Linet3Helper::getSetting("company.path");
$file = Company::getFilePath() . "ini.txt";
$model->iniFile = $_POST['FormOpenfrmt']['iniFile'];
$model->iniFile = \yii\web\UploadedFile::getInstance($model, 'iniFile');
if ($model->iniFile->saveAs($file)) {
$model->iniFile = $file;
//$model->read();
}
$file = Company::getFilePath() . "/bkmv.txt";
$model->bkmvFile = $_POST['FormOpenfrmt']['bkmvFile'];
$model->bkmvFile = \yii\web\UploadedFile::getInstance($model, 'bkmvFile');
if ($model->bkmvFile->saveAs($file)) {
//$corComp = ;
$model->bkmvFile = $file;
$model->readIni();
$this->company = $model->companyId;
Company::select($this->company);
$model->readBkmv();
Company::select($this->company);
}
return $this->render('openfrmtimportajax', array('model' => $model));
Yii::$app->end();
}
return $this->render('openfrmtimport', array('model' => $model));
//echo $model->read();
}
示例3: getCompanies
/**
* Get Companies options for 'select' dropdown in Vuejs format
*/
public function getCompanies(Request $request, $company_id, $trade_id, $site_id)
{
$company_list = Auth::user()->company->companyList('1')->pluck('id')->toArray();
if ($company_id == 'match-trade' || $trade_id == 'match-trade') {
//if ($trade_id == 'match-trade')
// All authorised companies that have the given trade_id
$companies = Company::select(['companys.id', 'companys.name'])->join('company_trade', 'companys.id', '=', 'company_trade.company_id')->where('companys.status', '1')->where('company_trade.trade_id', $trade_id)->whereIn('companys.id', $company_list)->orderBy('name')->get();
} else {
if ($company_id == 'all') {
// All authorised companies
$companies = Company::where('status', '1')->whereIn('id', $company_list)->orderBy('name')->get();
} else {
// All authorised companies except the given company_id
$companies = Company::where('status', '1')->whereIn('id', $company_list)->where('id', '<>', $company_id)->orderBy('name')->get();
}
}
// Unique array of companies currently on planner for given site_id
$companiesOnPlanner = SitePlanner::distinct()->select('entity_id')->where('site_id', $site_id)->where('entity_type', 'c')->groupBy('entity_id')->lists('entity_id')->toArray();
$array = [];
$array[] = ['value' => '', 'text' => 'Select company'];
if ($company_id == 'match-trade') {
$array[] = ['value' => 'gen', 'text' => 'Unassigned (Generic)'];
}
// Create array in specific Vuejs 'select' format.
foreach ($companies as $company) {
$text = $company->name;
if (in_array($company->id, $companiesOnPlanner)) {
$text = '<b>' . $company->name . '</b>';
}
$array[] = ['value' => $company->id, 'text' => $text, 'name' => $company->name];
}
return $array;
}
示例4: onDelete
/**
* Function Remove
* Process Delete the Brand Data
*
* @return \Illuminate\Http\JsonResponse
*/
public function onDelete()
{
$id = Input::get('id');
$Model = \App\Models\Company::select(['id'])->where('id', $id)->first();
if ($Model) {
\App\Models\Company::where('id', $id)->delete();
$param['message'] = Lang::get('info.has deleted');
$param['error'] = false;
} else {
$param['message'] = Lang::get('info.has error');
$param['error'] = true;
}
return json_encode($param);
}