Questions tagged [yii2-basic-app]

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

GitHub

Official Site

769 questions
5
votes
2 answers

How to add custom validation function in Dynamic model in Yii2?

I am using dynamic model in my yii2 basic application. following is code of my dynamic model. $model = new \yii\base\DynamicModel([ 'role', 'from_rm', 'to_rm', 'user1_subdistrcts' ]); $model->addRule(['user1_subdistrcts', 'role'],…
Vinit Singh
  • 1,113
  • 2
  • 21
  • 45
5
votes
2 answers

How to login using two different model or switch identity class in yii2?

I want to allow user login from two different model. Config.php 'user' => [ 'identityClass' => 'app\models\User', //one more class here 'enableAutoLogin' => false, 'authTimeout' => 3600*2, ], LoginForm.php public…
Insane Skull
  • 8,810
  • 9
  • 38
  • 59
5
votes
4 answers

Access variable in Gridview function yii2

I am trying to access a variable on view file into Gridview but it is throwing error that it should be array but null given i am declaring $totalDays on top of my view file and i am using it in Gridview like below [ 'attribute' => …
Mike Ross
  • 2,753
  • 3
  • 38
  • 81
5
votes
4 answers

After login successfully, URL not changing in yii2-app-basic

I was going to About Page after Successfully login. It's OK. But, URL not changing to About Page. It is same as login Page, but the content of page is About Page. SiteController.php public function actionLogin() { if (!\Yii::$app->user->isGuest)…
Nana Partykar
  • 10,175
  • 8
  • 43
  • 73
5
votes
3 answers

Displaying subdirectory name in the url in Yii2 for static pages

Iam creating static pages for a client using Yii2. I am using yii2 because the client has some other requirements to scale up the web later. I use Yii2 Basic app. The yii2 basic has default pages like about, contact etc. The url for those pages…
5
votes
1 answer

How to createabsoluteurl passing two parameters in yii2

I am newbie in Yii2. Please help me to achieve this. I want to know how to create absoluteurl in yii2. I have tried the code given below but I want something different. echo Yii::$app->urlManager->createAbsoluteUrl(['site/confirm', 'id' =>…
Sangita Pal
  • 125
  • 1
  • 7
5
votes
2 answers

Delete is not working Method Not Allowed (#405) gridview yii2

This is my gridview, I changed from class actionColumn to this: [ 'format' => 'html', 'contentOptions'=>['style'=>'width: 5px;'], 'value' => function($model) { if($model->id == Yii::$app->user->identity->id)…
5
votes
3 answers

Yii2 db mysql connection throw ssh port 33060

I have problem with connecting to mysql database throw ssh on port 33060, My conf : return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=myDatabase', 'emulatePrepare' =>true, 'username' => 'user', 'password' =>…
Este
  • 141
  • 1
  • 6
4
votes
2 answers

Yii2 WHERE IN query

The following active record WHERE IN query does not work. According to the docs this should work: $data = $dropDownData->find() ->select('country, country_text') ->distinct() ->WHERE(['in',…
user794846
  • 1,657
  • 3
  • 25
  • 64
4
votes
1 answer

How to disable bootstrap from Yii2 basic?

I removed yiisoft/yii2-bootstrap from composer.json and update composer, removed bootstrap from assets/AppAsset.php, but still loads bootstrap CSS and JS! When I remove head() ?> from layout, CSS doesn't load, but bootstrap.js is…
Masoud92m
  • 542
  • 6
  • 20
4
votes
2 answers

Yii2 Horizontal form

What I want to do is to change from bootstrap vertical to horizontal form and this is what I've tried: 'horizontal', 'action' => ['index'], 'method' => 'get', 'fieldConfig' => [ …
Chhorn Soro
  • 2,735
  • 5
  • 22
  • 41
4
votes
4 answers

Installing Yii2 via composer failed

I want to install yii2 via composer and it's give me a error here is error: Your requirements could not be resolved to an installable set of packages. Problem 1 - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable |…
RezaGM
  • 66
  • 1
  • 5
4
votes
2 answers

Invalid validation rule: a rule must specify both attribute names and validator type, in Yii2

In my basic app project, I'm trying to integrate the signup form, I'm getting this error: Invalid validation rule: a rule must specify both attribute names and validator type. My code is here. SignUpForm.php
Mohan Prasad
  • 572
  • 8
  • 30
4
votes
1 answer

Yii2 > How to store html output of a _form view into a string variable

I want to store the rendered html output of a form view which uses ActiveForm and Html Helper into a variable within my Controller. I've tried storing result of a renderPartial directly to a variable, which did not work: $htmlform =…
Trevor
  • 129
  • 1
  • 10
4
votes
2 answers

Invalid Cofiguration - yii\base\InvalidConfigException - Yii2

I've just installed Yii2-User module/Dektrium to my Yii2-app-basic application by this command composer require "dektrium/yii2-user:0.9.*@dev" config/console.php return [ . . 'modules' => [ 'gii' => 'yii\gii\Module', …
Nana Partykar
  • 10,175
  • 8
  • 43
  • 73
1
2
3
51 52