public function getStats() { $province = Province::all(); $array = []; foreach ($province as $p) { $array[] = [$p->name, $p->points()]; } return json_encode($array); }
function edit_resume() { $provinces = Province::get(); $skill_categories = Skill_category::with(['skills.user_skills' => function ($query) { $query->where('user_id', $this->user['id'])->where('value', '>', '0'); }])->orderBy('sort_order', 'asc')->get(); // return $skill_categories; $resumes = Resume::with('shokushu')->with('keitai')->where('user_id', $this->user['id'])->orderBy('syear', 'desc', 'smonth', 'desc')->get(); $shokushus = Shokushu::orderby('sort_order', 'asc')->get(); $keitais = Keitai::orderby('sort_order', 'asc')->get(); return view('my.edit.edit_resume', ['provinces' => $provinces, 'resumes' => $resumes, 'shokushus' => $shokushus, 'keitais' => $keitais, 'skill_categories' => $skill_categories]); }
/** * Run the database seeds. */ public function run() { Province::truncate(); City::truncate(); $jsonProvinces = File::get(database_path('json/provinces.json')); $dataProvinces = json_decode($jsonProvinces); $dataProvinces = collect($dataProvinces); foreach ($dataProvinces as $d) { $d = collect($d)->toArray(); $p = new Province(); $p->fill($d); $p->save(); } $jsonCities = File::get(database_path('json/cities.json')); $dataCities = json_decode($jsonCities); $dataCities = collect($dataCities); foreach ($dataCities as $d) { $d = collect($d)->toArray(); $p = new City(); $p->fill($d); $p->save(); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Province::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, 'region_id' => $this->region_id]); $query->andFilterWhere(['like', 'province_code', $this->province_code])->andFilterWhere(['like', 'province_description', $this->province_description])->andFilterWhere(['like', 'provincecol', $this->provincecol]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Province::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->joinWith('country'); $query->andFilterWhere(['province_id' => $this->province_id, 'mi_country.flag_active' => 1]); $query->andFilterWhere(['like', 'country_name', $this->country_id])->andFilterWhere(['like', 'province_name', $this->province_name]); return $dataProvider; }
public function run () { DB::table('provinces')->delete(); Province::create([ 'cname' => '上海', 'ename' => 'ShangHai', 'code' => 1, 'country_code' => 1, 'active' => 1 ]); }
private function _users() { $provinces = Province::all(); foreach ($provinces as $p) { $faker = \Faker\Factory::create(); $user = new User(); $user->name = $faker->name; $user->province_id = $p->id; $user->email = $faker->email; $user->password = Hash::make('123456'); $user->save(); $license = License::where('used', 0)->first(); $license->used = 1; $license->save(); $license->user()->attach($user); $score = new Score(); $score->score = rand(100, 3500); $score->license = $license->license; $score->save(); } }
use app\models\Employee; use app\models\Province; echo Province::findOne(['PROVINCE_ID' => 12])->PROVINCE_NAME; /* @var $this yii\web\View */ /* @var $model app\models\Employee */ $this->title = $model->emp_id; $this->params['breadcrumbs'][] = ['label' => 'Employees', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="employee-view"> <h1>View <?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Update', ['update', 'id' => $model->emp_id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Delete', ['delete', 'id' => $model->emp_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'sex', 'value' => $model->sex === null ? '' : Employee::itemAlias('sex', $model->sex)], ['label' => 'ชื่อ-นามสกุล', 'value' => $model->getFullname()], 'fullName', 'address:ntext', 'zip_code', ['attribute' => 'birthday', 'format' => 'html', 'value' => Yii::$app->formatter->asDate($model->birthday, 'medium')], 'email:email', 'mobile_phone', 'position', 'salary', 'website:url', 'skill', 'countries', 'age', 'experience', 'personal_id', ['attribute' => 'sex', 'value' => $model->marital === null ? '' : Employee::itemAlias('marital', $model->marital)], 'provinces.PROVINCE_NAME', 'amphurs.AMPHUR_NAME', 'districts.DISTRICT_NAME', ['attribute' => 'province', 'value' => @Province::findOne(['PROVINCE_ID' => $model->province])->PROVINCE_NAME], 'provinceName', 'amphurName', 'districtName', 'social', ['attribute' => 'resume', 'format' => 'html', 'value' => !$model->resume ? '' : Html::a('ดาวน์โหลด', ['/employee/download', 'type' => 'resume', 'id' => $model->emp_id])], 'expire_date', 'create_date', 'modify_date']]); ?> </div>
public function getProvince($id = NULL) { return $id == NULL ? Province::all() : Province::find($id); }
/** * @return \yii\db\ActiveQuery */ public function getProvinces() { return $this->hasMany(Province::className(), ['region_id' => 'id']); }
/** * Finds the Province model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @param integer $region_id * @return Province the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id, $region_id) { if (($model = Province::findOne(['id' => $id, 'region_id' => $region_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
echo $form->field($model, 'experience')->textInput(); ?> </div> </div> <div class="page-header"> <h4>ข้อมูลสำหรับการติดต่อ </h4> </div> <?php echo $form->field($model, 'address')->textInput(); ?> <div class="row"> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'province')->dropdownList(ArrayHelper::map(Province::find()->all(), 'PROVINCE_ID', 'PROVINCE_NAME'), ['id' => 'ddl-province', 'prompt' => 'เลือกจังหวัด']); ?> </div> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'amphur')->widget(DepDrop::classname(), ['options' => ['id' => 'ddl-amphur'], 'data' => $amphur, 'pluginOptions' => ['depends' => ['ddl-province'], 'placeholder' => 'เลือกอำเภอ...', 'url' => Url::to(['/employee/get-amphur'])]]); ?> </div> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'district')->widget(DepDrop::classname(), ['data' => $district, 'pluginOptions' => ['depends' => ['ddl-province', 'ddl-amphur'], 'placeholder' => 'เลือกตำบล...', 'url' => Url::to(['/employee/get-district'])]]); ?> </div> </div>
public function getProvince (Request $request) { $provinces = Province::all(); $html = $this->provinceList($provinces); return $this->successResponse('res', $html); }
/** * @return \yii\db\ActiveQuery */ public function getProvince() { return $this->hasOne(Province::className(), ['id' => 'province_id']); }
public function getProvinces() { return @$this->hasOne(Province::className(), ['PROVINCE_ID' => 'province']); }
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'city_code')->textInput(['maxlength' => 32]); ?> <?php echo $form->field($model, 'city_description')->textInput(['maxlength' => 32]); ?> <?php echo $form->field($model, 'citycol')->textInput(['maxlength' => 45]); ?> <?php echo $form->field($model, 'province_id')->dropdownList(ArrayHelper::map(Province::find()->all(), 'id', 'province_description'), ['prompt' => 'Choose a province']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<div class="form-group"> <label class="col-sm-3 control-label">Country</label> <div class="col-sm-6"> <?php echo $form->field($model, 'country_id')->label(false)->dropDownList(ArrayHelper::map(Country::find()->all(), 'country_id', 'country_name'), ['prompt' => 'Select Country Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group"> <label class="col-sm-3 control-label">Province</label> <div class="col-sm-6"> <?php echo $form->field($model, 'province_id')->label(false)->dropDownList(ArrayHelper::map(Province::find()->all(), 'province_id', 'province_name'), ['prompt' => 'Select Province Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group"> <label class="col-sm-3 control-label">Customer</label> <div class="col-sm-6"> <?php echo $form->field($model, 'customer_id')->label(false)->dropDownList(ArrayHelper::map(Customer::find()->all(), 'customer_id', 'first_name'), ['prompt' => 'Select Customer Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group">
public function getReceiverinfo (Request $request) { $user = Auth::user(); $receiverInfoSet = ReceiverInfo::where('uid', '=', $user->id) ->where('active', '=', '1') ->orderBy('last_used', 'desc') ->orderBy('created_at', 'desc') ->get(); $provinceSet = Province::all(); $provinces = array(); foreach ($provinceSet as $province) { array_push($provinces, $province); } $cities = City::all(); $districts = array(); foreach ($cities as $city) { $district = District::where('city_code', '=', $city->code) ->where('active', '=', '1') ->first(); if ($district) { array_push($districts, $district); } } $receiverInfos = array(); foreach ($receiverInfoSet as $receiverInfo) { array_push($receiverInfos, $receiverInfo); } $data = [ 'receiverInfos' => $receiverInfos, 'provinces' => $provinces, 'cities' => $cities, 'districts' => $districts, 'receiverActive' => true, 'wTitle' => '个人中心 - 收货人信息' ]; return view('profile/receiver_info', $data); }
?> <div class="contact-form"> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'firstname')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'lastname')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'address')->textarea(['rows' => 6]) ?> <div class="form-group"> <?= Html::label('จังหวัด','province');?> <?= Html::dropDownList('province',$province, ArrayHelper::map(Province::find() ->orderBy('province_name ASC') ->all(),'id','province_name'), [ 'class'=>'form-control', 'id'=>'province', 'prompt'=>'-เลือกจังหวัด-', 'onchange'=>' $.get("'.Url::toRoute('base/loaddistrict').'", {id:$(this).val()}) .done(function(data){ $("select#district").html(data); }); ' ] );?>
public function index() { $title = 'Statistieken'; $province = Province::all(); return view('stats.index', compact('title', 'province')); }
/** * Show the application dashboard. * * @return Response */ public function index() { $title = 'Homepagina'; $provinces = Province::all(); return view('home.index', compact('title', 'provinces')); }