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
27
votes
25 answers

Yii2: How to add textarea in yii2

What is the mapping of textarea in yii2 ? How to write this in yii2 format? What is an alternative or way to define textarea in yii2?
user4428957
16
votes
10 answers

model->save() Not Working In Yii2

Previously, I was not using $model->save() function for inserting or updating any data. I was simply using createCommand() to execute query and it was working successfully. But, my team members asked me to avoid createCommand() and use…
Nana Partykar
  • 10,175
  • 8
  • 43
  • 73
14
votes
2 answers

LIMIT is not working in ActiveDataProvider

I am using following code and the limit doesnt work. But if I see the command than it shows limit in that, but when I pass the query to ActiveDataProvider it fetch all the records: $data= User::find()->where(['category_id'=> 5])->orderBy(['rand()'…
Mike Ross
  • 2,753
  • 3
  • 38
  • 81
11
votes
2 answers

Order by rand() in yii2

I want to write following query in yii2, but I can't get the expected output: SELECT * FROM user where category_id=5 ORDER BY rand() LIMIT 4 For that I have done following: $data= User::find()->where(['category_id'=>…
Mike Ross
  • 2,753
  • 3
  • 38
  • 81
10
votes
2 answers

ActiveForm without model yii2

I want to create ActiveForm without model for just in case something. I did try with dynamicModel but i got some error : use yii\base\DynamicModel; $model = DynamicModel::validateData(compact('KOMENTAR'), [ [['KOMENTAR'], 'string', 'max' =>…
9
votes
2 answers

The configuration for the "modules" component must contain a "class" element

I have define a module named `admin' in yii2. I have registered this module in web.php config file. But when I try to access this I face with an error. here is my web.php
Behzad Hassani
  • 2,025
  • 4
  • 25
  • 44
8
votes
1 answer

How to upgrade Yii 1.x to Yii 2.0

How to upgrade Yii 1.x version to Yii 2.0 latest release version? I am using ubuntu OS , Process to updating my old Yii to new Yii release version 2.0?
7
votes
2 answers

Yii2 enforce 404 or 500 error

In my controller's action of Yii2 application suppose the following: public function actionView($i) { if ($i < 20) { //I want execute error 404 } } All what I can to do now is just setting a flash message and redirect to another action.…
SaidbakR
  • 11,955
  • 16
  • 89
  • 173
6
votes
1 answer

How to display a HTML tag in Yii2 form error summary

I am trying to display a link in error message in login for, but it is not working. The error message in LoginForm valdiation: $this->addError($attribute, 'Your account has been disabled. Enable It'); In login.php (view):
6
votes
1 answer

Yii2 full calendar event filtering not working

I'm using Philipp Frenzel FullCalendar in Yii2 framework and its working perfectly. I want to implement basic filter events on calendar base on option select but my codes still not working. Help would be highly appreciated. This is inside…
Hendy
  • 255
  • 1
  • 5
  • 26
6
votes
2 answers

How to Create a REST API for Yii2-basic-template

I wanted to create a REST API for a yii2 basic template. I followed the following link. I created a table named users, a controller named UserController
Bloodhound
  • 2,720
  • 8
  • 31
  • 66
6
votes
1 answer

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
2 answers

Pretty URL for one single controller (module) in yii2

Suppose my application path is:- http://www.example.com/index.php?r=dashboard/event/view I make a new controller on which I want to change the URL to pretty URL. Default URL for the new…
pawansgi92
  • 935
  • 10
  • 24
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
  • 627
  • 2
  • 14
  • 34
5
votes
1 answer

How to control visibility of buttons in ActionColumn of yii2 GridView when using yii2 RBAC with a rule class?

I understand the visibility of ActionColumn buttons can be controlled like this : $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' =>…
1
2 3
51 52