/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { // $type = \App\Models\Type::find($id); return view('types', ['type' => $type]); // return view('types',compact("type")); same as previos }
public function actionModel() { $crawler = new Crawl(); $crawler->arr_att_clean = array('script', '.thumblock'); $url = 'http://khoahoc.tv/quan-the-tu-vien-meteora-1882'; $namepath = '/html/body/div[1]/div[3]/div[1]/h1'; $contentpath = '/html/body/div[1]/div[3]/div[1]/div[3]'; $type_path = '/html/body/div[1]/div[3]/div[1]/div[2]/span[3]/a'; if (!@($name = $crawler->getTitle($url, $namepath))) { echo 'error_' . "\n"; } else { $name = $crawler->getTitle($url, $namepath); echo $name = rUrl::utf8($name); $content = $crawler->getTitle($url, $contentpath); $type = $crawler->getTitle($url, $type_path); $content = $crawler->removeLink($content); $images = $crawler->getImagesFromMeta($url); $keywords = $crawler->getKeywords($url); $descriptionmeta = $crawler->getDescriptionmeta($url); $type_slug = rUrl::slug($type); $mType = Type::find()->Where(['LIKE', 'slug', $type_slug])->one(); $id_type = $mType['id']; $slug = rUrl::slug($name); if ($id_type !== null) { $id_type = $mType['id']; } else { $id_type = 22; } $model = new News(); $model->attributes = ['name' => $name, 'slug' => $slug, 'images' => $images, 'description' => $content, 'seo_keywords' => $keywords, 'view_count' => rand(1000, 10000), 'source' => 'kh', 'seo_title' => $descriptionmeta, 'type_id' => $id_type, 'created_at' => time(), 'updated_at' => time()]; //$model->save(); //echo "ok_" . $i . "\n"; // exit(); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Type::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_type' => $this->id_type]); $query->andFilterWhere(['like', 'desc_type', $this->desc_type])->andFilterWhere(['like', 'hexcolor_type', $this->hexcolor_type])->andFilterWhere(['like', 'icon_type', $this->icon_type]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Type::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', 'name', $this->name])->andFilterWhere(['like', 'name_eng', $this->name_eng]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Type::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, 'category_id' => $this->category_id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'images', $this->images])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'seo_keywords', $this->seo_keywords])->andFilterWhere(['like', 'seo_title', $this->seo_title]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Type::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // // find a single resource by ID $output = Type::find($id); if ($output) { $plans = $output->plans()->get(); if (count($plans)) { flashError('Type "' . $output->name . '" is still referred by Plans and cannot be deleted.'); return redirect()->back(); } $output->delete(); $message = 'Type with id "' . $id . '" deleted.'; return \Redirect::route('types.index')->with(['status' => $message]); } // $message = 'Error! Type with ID "' . $id . '" not found'; return \Redirect::route('types.index')->with(['status' => $message]); }
if ($item->id == Yii::$app->request->get('id') && !Yii::$app->request->get('type')) { echo 'class="current"'; } ?> > <a href="<?php echo Url::to(['site/category', 'slug' => $item->slug, 'id' => $item->id]); ?> "><?php echo $item->name; ?> </a> <ul style="width:200px;"> <?php foreach (Type::find()->where(['category_id' => $item->id, 'display' => MyDefine::yes])->all() as $rows) { ?> <li><i class="icon-right-open"></i><a href="<?php echo Url::to(['site/type', 'type' => $rows->slug, 'slug' => $item->slug, 'id' => $rows->id]); ?> "><?php echo $rows->name; ?> </a></li> <?php } ?> </ul>
echo Html::submitButton('Գեներացնել (Generate)', ['class' => 'btn btn-primary']); ?> <?php ActiveForm::end(); ?> <div class="site-index" style="width: 3500px;"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}', 'urlCreator' => function ($action, $model, $key, $index) { if ($action === 'update') { $arrayParams = ['MainSearch' => ['region' => $model->region]]; $arrayParams['id'] = $model->id; $params = array_merge(["site/main"], $arrayParams); $url = Yii::$app->urlManager->createUrl($params); return $url; } if ($action === 'delete') { $arrayParams = ['MainSearch' => ['region' => $model->region], 'id' => $model->id]; $params = array_merge(["site/delete"], $arrayParams); $url = Yii::$app->urlManager->createUrl($params); return $url; } }], ['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'city', 'value' => 'city0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'city', ArrayHelper::map(City::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'type', 'value' => 'type0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'type', ArrayHelper::map(Type::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'resident', 'children', 'employee', 'retiree', ['attribute' => 'dominant', 'value' => 'dominant0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'retiree', ArrayHelper::map(Dominant::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'mainTrashPlaces.trash_place_id', 'value' => 'trashPlaceMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashPlaces.trash_place_id', ArrayHelper::map(TrashPlace::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashMen.trash_man_id', 'value' => 'trashManMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashMen.trash_man_id', ArrayHelper::map(TrashMan::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'filter_trash_out', 'value' => 'trash_out', 'filter' => Html::activeDropDownList($searchModel, 'filter_trash_out', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_trash_count', 'value' => 'trash_count', 'filter' => Html::activeDropDownList($searchModel, 'filter_trash_count', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_1', 'value' => 'summer_count_1', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_1', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_2', 'value' => 'summer_count_2', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_2', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_3', 'value' => 'summer_count_3', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_3', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_summer_4', 'value' => 'summer_count_4', 'filter' => Html::activeDropDownList($searchModel, 'filter_summer_4', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_1', 'value' => 'winter_count_1', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_1', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_2', 'value' => 'winter_count_2', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_2', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_3', 'value' => 'winter_count_3', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_3', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'filter_winter_4', 'value' => 'winter_count_4', 'filter' => Html::activeDropDownList($searchModel, 'filter_winter_4', array('1' => '1-5', '2' => '6-10', '3' => '11-20', '4' => '20+'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'paper', 'value' => 'paper0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'paper', ArrayHelper::map(Paper::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashRelations.trash_relation_id', 'value' => 'trashRelationMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashRelations.trash_relation_id', ArrayHelper::map(TrashRelation::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category']), 'contentOptions' => ['style' => 'width: ' . $width . ';']], ['attribute' => 'mainTrashRecycles.trash_recycle_id', 'value' => 'trashRecycleMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainTrashRecycles.trash_recycle_id', ArrayHelper::map(TrashRecycle::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], ['attribute' => 'mainRubberItems.rubber_item_id', 'value' => 'rubberItemsMulti', 'filter' => Html::activeDropDownList($searchModel, 'mainRubberItems.rubber_item_id', ArrayHelper::map(RubberItems::find()->all(), 'id', 'nameBoth'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'answer_count', 'woman_count', ['attribute' => 'person', 'value' => 'person0.nameBothShort', 'filter' => Html::activeDropDownList($searchModel, 'person', ArrayHelper::map(Person::find()->all(), 'id', 'nameBothShort'), ['class' => 'form-control', 'prompt' => 'Select Category'])], 'date', 'interrogatory']]); ?> </div>
public function update(Request $request, $id) { $type = Type::find($id); $type->update($request->all()); return redirect(route('admin.type.index')); }
public function actionTables() { $params = Yii::$app->request->queryParams; $region = 1; if (!empty($params['MainSearch']['region'])) { $region = $params['MainSearch']['region']; } if (empty($params['excel'])) { $params['excel'] = false; } $data = Main::getMainData($region); if ($region == -1) { $regionWhere = []; } else { $regionWhere = ['region' => $region]; } $cityIds = ArrayHelper::map($data, 'city', 'city'); $regionWhere['id'] = array_values($cityIds); $cities = ArrayHelper::map(City::find()->where($regionWhere)->orderBy('id')->all(), 'id', 'nameBoth'); $types = ArrayHelper::map(Type::find()->orderBy('id')->all(), 'id', 'nameBoth'); $trashPlaceArm = ArrayHelper::map(TrashPlace::find()->orderBy('id')->all(), 'id', 'name'); $trashPlaceEng = ArrayHelper::map(TrashPlace::find()->orderBy('id')->all(), 'id', 'name_eng'); $trashManArm = ArrayHelper::map(TrashMan::find()->orderBy('id')->all(), 'id', 'name'); $trashManEng = ArrayHelper::map(TrashMan::find()->orderBy('id')->all(), 'id', 'name_eng'); $trashRelationArm = ArrayHelper::map(TrashRelation::find()->orderBy('id')->all(), 'id', 'name'); $trashRelationEng = ArrayHelper::map(TrashRelation::find()->orderBy('id')->all(), 'id', 'name_eng'); $trashRecycleArm = ArrayHelper::map(TrashRecycle::find()->orderBy('id')->all(), 'id', 'name'); $trashRecycleEng = ArrayHelper::map(TrashRecycle::find()->orderBy('id')->all(), 'id', 'name_eng'); $trashCountSummerArm = ArrayHelper::map(TrashCountSummer::find()->orderBy('id')->all(), 'id', 'name'); $trashCountSummerEng = ArrayHelper::map(TrashCountSummer::find()->orderBy('id')->all(), 'id', 'name_eng'); $trashCountWinterArm = ArrayHelper::map(TrashCountWinter::find()->orderBy('id')->all(), 'id', 'name'); $trashCountWinterEng = ArrayHelper::map(TrashCountWinter::find()->orderBy('id')->all(), 'id', 'name_eng'); return $this->render('tables', ['data' => $data, 'region' => $region, 'cities' => $cities, 'types' => $types, 'trashPlaceArm' => $trashPlaceArm, 'trashPlaceEng' => $trashPlaceEng, 'trashManArm' => $trashManArm, 'trashManEng' => $trashManEng, 'trashRelationArm' => $trashRelationArm, 'trashRelationEng' => $trashRelationEng, 'trashRecycleArm' => $trashRecycleArm, 'trashRecycleEng' => $trashRecycleEng, 'trashCountSummerArm' => $trashCountSummerArm, 'trashCountSummerEng' => $trashCountSummerEng, 'trashCountWinterArm' => $trashCountWinterArm, 'trashCountWinterEng' => $trashCountWinterEng, 'excel' => $params['excel']]); }
echo $form->field($model, 'hot')->dropdownList([M::no => 'No', M::yes => 'Yes']); ?> <?php echo $form->field($model, 'popular')->dropdownList([M::no => 'No', M::yes => 'Yes']); ?> <?php echo $form->field($model, 'feature')->dropdownList([M::no => 'No', M::yes => 'Yes']); ?> <?php echo $form->field($model, 'type_id')->dropdownList(ArrayHelper::map(Type::find()->asArray()->all(), 'id', 'name')); ?> </div> </div> <div class="tab-pane fade" id="demo-bsc-tab-3"> <h4 class="mar-btm text-thin">Second Tab</h4> <hr> <div class="form-group"> <?php echo $form->field($model, 'seo_keywords')->textInput(['maxlength' => true]);
public function getType($id) { return Type::find('name')->where(['id' => $id])->one(); }
?> <?php echo $form->field($model, 'username')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'password')->passwordInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'lastupdate')->textInput(); ?> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(Type::find()->where(["category" => "user"])->all(), 'id', 'type')); ?> <?php echo $form->field($model, 'state_id')->dropDownList(ArrayHelper::map(State::find()->where(["category" => "user"])->all(), 'id', 'state')); ?> <?php echo $form->field($model, 'sex')->radioList(['M' => 'Male', 'F' => 'Female']); ?> <?php echo $form->field($model, 'profile_id')->dropDownList(ArrayHelper::map(Profile::find()->where(["category" => "app"])->all(), 'id', 'name')); ?> <?php
public function edit($id) { $type = Type::find($id); return view('admin.type.edit', ['type' => $type]); }
/** * Store a newly created plan in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(StorePlanRequest $request) { // create new record $plan = Plan::create($request->except(['start', 'end'])); // set some defaults $plan->changer = Auth::user()->first_name; $plan->state = 1; $planDate = Carbon::instance($plan->date); // insert default service TIMES if requested if ($request->input('defaultValues') == 'Y') { $type = Type::find($plan->type_id); if (count($type)) { // default end time is only the time of day. We need to combine this with the plan date $startTme = Carbon::parse($type->start); $endTime = Carbon::parse($type->end); $plan->date = $planDate->copy()->addHour($startTme->hour)->addMinute($startTme->minute); $plan->date_end = $planDate->addHour($endTime->hour)->addMinute($endTime->minute); } } else { // request contains custom start and end times $startTme = Carbon::parse($request->start); $endTime = Carbon::parse($request->end); $plan->date = $planDate->copy()->addHour($startTme->hour)->addMinute($startTme->minute); $plan->date_end = $planDate->addHour($endTime->hour)->addMinute($endTime->minute); } $plan->save(); addDefaultRolesAndResourcesToPlan($plan); // insert default items if requested if ($request->input('defaultItems') == 'Y') { $dItems = DefaultItem::where('type_id', $plan->type_id)->get(); // $newItems = []; foreach ($dItems as $dItem) { // get single default item to create a nwe Item object $iNew = new Item(['seq_no' => $dItem->seq_no, 'comment' => $dItem->text, 'forLeadersEyesOnly' => $dItem->forLeadersEyesOnly]); // save the new item to the new plan $plan->items()->save($iNew); // if default item contains a default image, link the new Plan item to the image if ($dItem->file_id) { $file = File::find($dItem->file_id); $iNew->files()->save($file); } // array_push( $newItems, $iNew ); } } flash('New Plan added with id ' . $plan->id); // redirect back to the plan editor to create another plan if ($request->input('addAnother') == 'Y') { // use heper function to calculate next date for this plan $newDate = getNextPlanDate($plan); // send the default values to the View $request->session()->flash('defaultValues', ['type_id' => $plan->type_id, 'date' => $newDate, 'start' => $startTme->toTimeString(), 'end' => $endTime->toTimeString(), 'leader_id' => $plan->leader_id]); // get list of service types $types = Type::get(); // get list of users $users = User::orderBy('first_name')->get(); return view($this->view_one, array('types' => $types, 'users' => $users)); } return \Redirect::route('plans.edit', $plan->id); }
<?php use app\models\Type; use yii\helpers\Url; use app\helpers\MyDefine; ?> <div class="column-one-fourth"> <h5 class="line"><span>Danh mục.</span></h5> <ul class="footnav"> <?php foreach (Type::find()->where(['display' => MyDefine::yes])->asArray()->all() as $item) { ?> <li style="margin-bottom:-5px;" <?php if ($item['id'] == Yii::$app->request->get('id') && Yii::$app->request->get('type')) { echo "class='current'"; } ?> > <a href="<?php echo Url::to(['site/type', 'slug' => Yii::$app->request->get('slug'), 'type' => $item['slug'], 'id' => $item['id']]); ?> "><?php echo $item['name']; ?> </a> </li><br /> <?php } ?>
echo '<label class="control-label">' . Yii::t('app', 'From') . '</label>'; echo DatePicker::widget(['model' => $model, 'attribute' => 'start_date', 'type' => DatePicker::TYPE_COMPONENT_PREPEND, 'options' => ['placeholder' => ''], 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd']]); ?> </div> </div><p> <div class="row"> <div class="col-sm-11"> <?php echo '<label class="control-label">' . Yii::t('app', 'To') . '</label>'; echo DatePicker::widget(['model' => $model, 'attribute' => 'end_date', 'type' => DatePicker::TYPE_COMPONENT_PREPEND, 'options' => ['placeholder' => ''], 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd']]); ?> </div> </div><p> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(Type::find()->all(), 'id_type', 'desc_type'), ['prompt' => Yii::t('app', 'All')]); ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(Category::find()->where(['user_id' => Yii::$app->user->identity->id])->orderBy("desc_category ASC")->all(), 'id_category', 'desc_category'), ['prompt' => Yii::t('app', 'All')]); ?> <?php echo $form->field($model, 'value'); ?> <?php echo $form->field($model, 'description'); ?> <?php
// "lastname"=>"Jai", // "email"=>"*****@*****.**", // "password"=>"bla" // ]); // return $user; }); Route::get('about', "PagesController@showAbout"); Route::get('contact', "PagesController@showContact"); Route::get('login', "LoginController@showLoginForm"); Route::post('login', "LoginController@processLogin"); Route::get('logout', "LoginController@logout"); Route::get('cart', "CartController@showCart"); Route::post('cartItems', "CartController@addItem"); Route::post('orders', "CartController@checkout"); Route::get('types/{id}', function ($id) { // create types controller and put it under show// $type = \App\Models\Type::find($id); return view('types', ['type' => $type]); // return view('types',compact("type")); same thing as above }); // Route::get('products/create',"ProductsController@create"); // Route::post('products', "ProductsController@store"); // Route::get('products/{id}/edit',"ProductsController@edit"); // Route::put('products/{id}',"ProductsController@update"); Route::resource('products', 'ProductsController'); // Route::get('users/create', "UsersContollers@create"); // Route::get('users/{id}',"UsersContollers@show"); // Route::post('users',"UsersContollers@store"); // Route::get('users/{id}/edit',"UsersContollers@edit" // Route::put('users/{id}',"UsersContollers@update" Route::resource('users', 'UsersController');
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $type = Type::find($id); $type->delete(); return redirect('admin/aiksteliu_tipai'); }
} </style> <div class="site-main"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'city', ['options' => ['class' => 'form-inline col-sm-10']])->dropDownList(ArrayHelper::map(City::find()->where(['region' => $region])->all(), 'id', 'nameBoth'), ['class' => 'col-sm-6 form-control'])->label(null, ['class' => 'col-sm-4']); ?> <div class="clearfix"></div> <hr> <?php echo $form->field($model, 'type', ['options' => ['class' => 'form-inline col-sm-10']])->radioList(ArrayHelper::map(Type::find()->all(), 'id', 'nameBoth'), ['class' => 'radio col-sm-6', 'separator' => '<span style="padding-left: 30px;"></span>'])->label(null, ['class' => 'col-sm-4']); ?> <div class="clearfix"></div> <hr> <?php echo $form->field($model, 'resident', ['options' => ['class' => 'form-inline col-sm-10']])->label(null, ['class' => 'col-sm-4'])->textInput(['readonly' => 'readonly']); ?> <div class="clearfix"></div> <?php echo $form->field($model, 'resident_man', ['options' => ['class' => 'form-inline col-sm-10']])->label(null, ['class' => 'col-sm-4'])->textInput(['class' => 'quantity form-control']); ?> <div class="clearfix"></div> <?php echo $form->field($model, 'resident_woman', ['options' => ['class' => 'form-inline col-sm-10']])->label(null, ['class' => 'col-sm-4'])->textInput(['class' => 'quantity form-control']);
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Session::get('level') == '1' || Session::get('level') == '2' && Session::get('fingerprint') == md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'])) { $Type = Type::find(e($id)); DB::transaction(function () use($Type) { Type::find($Type->id)->delete(); }); return Redirect::to('type'); } else { return Redirect::to('/'); } }
public static function fromCategoryall($id) { $idcat = Type::find()->where(['category_id' => $id])->all(); if (count($idcat) > 1) { foreach ($idcat as $item) { $arr[] = $item->id; } } else { $arr[] = null; } return self::find()->where(['type_id' => $arr])->count(); }