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

800 questions
5
votes
1 answer

how to write if condition inside where condition based on subquery in yii2 query builder

I have a subquery inside main query as below: $subquery = (new Query())->select('COUNT(project_sup_id)') ->from('project_supervisors AS sup') ->where(['AND','sup.project_ref_id = p.project_id']); $uQuery =(new…
rji rji
  • 697
  • 3
  • 17
  • 37
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'],…
Ninja Turtle
  • 1,293
  • 2
  • 24
  • 50
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
  • 9,220
  • 9
  • 44
  • 63
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,942
  • 5
  • 49
  • 101
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,556
  • 10
  • 48
  • 77
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
2 answers

How to use migrate command in yii2 basic template

I am trying to use migrate command with yii2 basic template i have tried "yii migrate" and also "php yii migrate" but none of them are working. i also tried php init but it says "could not open input file: init".
user2732844
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
  • 151
  • 1
  • 1
  • 7
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
  • 602
  • 1
  • 8
  • 24
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
  • 3,061
  • 8
  • 27
  • 43
4
votes
4 answers

yii2 how to run console controller function

I'm stuck. I'm trying to run some function from the command shell. I'm using the HelloController from the basic project. When I run php yii hello it's working good and the index function is running but if I try to run different function like php yii…
eli
  • 205
  • 2
  • 5
  • 12
4
votes
1 answer

How to add custom action to yii\rest\activecontroller extended controller in yii2?

i want to add login action in my controller ut its giving me page not found error. i know there are many posts like this but no one has helped me yet. code for my controller:
srk_pathan
  • 396
  • 2
  • 10
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
1
2
3
53 54