yii2

How to remove frontend/web from url in Yii2 advanced so that it doesn't appear when I use Url::to

旧巷老猫 提交于 2019-12-12 04:24:54
问题 I have written .htaccess files to prevent frontend/web from appearing in url but when I saet links through Url::to it appears in url. This is my .htaccess in root directory: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On </IfModule> <IfModule mod_rewrite.c> # deal with admin first RewriteCond %{REQUEST_URI} ^/(admin) RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] RewriteCond %{REQUEST_URI} !^/backend/web/(assets

Yii2 Gridview Displaying 4 identical Pages of Results

耗尽温柔 提交于 2019-12-12 04:21:56
问题 I am working on a web application based off of the yii2 advanced application template. I have written a database query and implemented it with findbysql() returning the correct records via a grid-view generated from the gii CRUD. However for some reason 4 pages of identical results are returned. Each page is showing identical primary keys (1-10) in order, while the element index increases linearly across all 4 pages (1-40). I have commented out the action column so i figured i did not need to

Undefined variable: yii2

假如想象 提交于 2019-12-12 04:19:05
问题 Getting error when I am trying to create dynamic form in using yii2-dynamicform. at the time of create method it is working fine but at the time of update showing the error. I have two tables one is 1.vendors & 2.vendors_more_categories Relation is 1-* between vendors & vendors_more_categories I just refereed https://github.com/wbraganca/yii2-dynamicform this link. <?php namespace app\controllers; namespace backend\controllers; use Yii; use app\models\Vendors; use app\models\VendorsSearch;

Getting (not set) when joining a column which has a sum function in yii2

百般思念 提交于 2019-12-12 04:07:14
问题 I have two tables - parties, bills. In parties table the fiels are parties_partyname,parties_district. And in the bills table it has field bills_partyname, billamount,billdate. I want to see the query as SELECT parties_district,parties_partyname, COALESCE(sum(bills.billamount),0) as sale FROM `parties` left join bills on parties.parties_partyname = bills.bills_partyname group by parties.parties_partyname My Search Model looks like - $query = Parties::find() ->select('parties.parties_district,

Yii2 - Export Kartik-v

二次信任 提交于 2019-12-12 03:58:20
问题 I have many tables that can be displayed in Yii2. One of them is like this: We can download the table by clicking download button. Many tables can be download one by one. One table can only download its table. Actually, I want all of tables can be downloaded in one file. What I want to ask: Is there any way to download all of the tables and make them on one document? Here is my view code: <?php use yii\helpers\Html; use kartik\grid\GridView; use yii\widgets\Pjax; use yii\bootstrap\Model; use

Updating select options after AJAX request

狂风中的少年 提交于 2019-12-12 03:55:53
问题 I have select field looking like that: <?= $form->field($place, "[{$index}]id")->widget(Select2::classname(), [ 'data' => ArrayHelper::map(PresentationPlace::find()->all(), 'id', 'displaynew'), 'class' => 'field', 'options' => ['placeholder' => Yii::t('app', 'Pick place for presentation')], 'pluginOptions' => [ 'allowClear' => false ], ])->label(Yii::t('app', Yii::t('app', 'Place'))) ?> And after that field, I have short form for adding new place - you can fill it and send AJAX request. It

How to set separate homeUrl for authenticated users and guests in yii2

我与影子孤独终老i 提交于 2019-12-12 03:49:48
问题 I'm wondering is it possible to make different homeUrl for authenticated and guest users? I have such rules in SiteController.php public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['logout', 'signup'], 'rules' => [ [ 'actions' => ['signup'], 'allow' => true, 'roles' => ['?'], 'denyCallback' => function() { return $this->redirect('/account'); } ], [ 'actions' => ['logout', 'condition'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [

Insert multiple rows into table by checkboxcolumn in yii2

坚强是说给别人听的谎言 提交于 2019-12-12 03:47:45
问题 I have a table rawmaterial. The fields are - rmname, usedate, useqty, unitcost, productname, chargenumber . I've added a gridview (which comes from rmtemplate table) with a checkboxcolumn in the form. The gridview contains columns productname, rmname, qty, unitcost . How can I insert the checked rows along with usedate, chargenumber(which come from respective textboxes) in the table rawmaterial. I've checked ActiveRecord batch insert (yii2) but not getting how to use it with checkbocolumn.

How do I apply a custom alias inputmask using jquery?

不问归期 提交于 2019-12-12 03:43:38
问题 I'm trying to use a inputmask on a Yii2 form input. Here is my code: var IDR={"alias":"numeric","prefix":"Rp","digits":0,"digitsOptional":false,"decimalProtect":true,"groupSeparator":",","radixPoint":".","radixFocus":true,"autoGroup":true,"autoUnmask":true,"removeMaskOnSubmit":true}; Inputmask.extendAliases({"IDR": {"alias":"numeric","prefix":"Rp","digits":0,"digitsOptional":false,"decimalProtect":true,"groupSeparator":",","radixPoint":".","radixFocus":true,"autoGroup":true,"autoUnmask":true,

Yii2: Select2, How to set initValueText in Gridview or Tabularform?

 ̄綄美尐妖づ 提交于 2019-12-12 03:37:31
问题 I need to set initValueText for Select2, which is in loop, like gridview or Tabularform. but I don't know how to set right value for each. <?= TabularForm::widget([ 'dataProvider' => $dataProvider, 'form' => $form, 'actionColumn' => false, 'checkboxColumn' => false, 'attributeDefaults' => [ 'type' => TabularForm::INPUT_RAW, ], 'attributes' => [ 'test' => [ 'type' => Form::INPUT_WIDGET, 'widgetClass' => Select2::className(), 'options' => [ 'name' => 'test', 'options' => [ 'class' => 'test-to