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

Set href ="#" or unset html::a href from grid-view yii2

I have the following code: [ 'format' => 'raw', 'contentOptions'=>['style'=>'width: 5px;'], 'value' => function($model) { if($model->id == Yii::$app->user->identity->id) { return …
4
votes
3 answers

How to get params in url , and it is array? yii2

I have url like this http://localhost/belajar4/web/index.php?r=data%2Fsingle&id=2&DataSearch[TANGGAL]=2015-08-04&DataSearch[TANGGAL_SELESAI]=2015-08-12 And I want to get DataSearch['Tanggal'] dan DataSearch[TANGGAL_SELESAI] I have tried for id…
4
votes
1 answer

Yii2: Web service Request and Response Logger

I am trying to create a Request and Response Logger for a web service created in Yii 2.0.5 for debugging purpose. Basically my motive is to track all the request, request data, response data and for this purpose I am using Yii Events. So far I have…
Sagar Guhe
  • 1,131
  • 10
  • 32
3
votes
1 answer

Yii2 - How to set dynamic authTimeout in User Identity?

Here, I have extended User Identity of Yii2. This is my configuration. 'user' => [ 'identityClass' => app\models\UserMaster::class, 'enableAutoLogin' => false, 'loginUrl' => ['/auth/login'], …
akshaypjoshi
  • 1,180
  • 1
  • 11
  • 22
3
votes
2 answers

Yii2 rules work only use scenario

I write two scenario in Yii2 comment model, when user logged on or is guest. my rules is: public function rules() { return [ [['user_id'], 'required', 'on' => self::SCENARIO_USER], [['name', 'email'], 'required',…
Masoud92m
  • 542
  • 6
  • 20
3
votes
3 answers

Yii2, Component, Make a single instance and access it everywhere in the web application

I would like to create a component in yii2 that can be accessed throughout the web application but only create one instance and be able to retrieve that instance wherever needed. namespace app\components; use yii; use yii\base\Object; class…
3
votes
2 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
  • 125
  • 2
  • 3
  • 10
3
votes
1 answer

Yii2. Many inputs for one Model/DB field

How such inputs could be translated into DATE field in DB? Customer insisted on such way to input user birthdate. First my thought was simply to concat in one field in beforeValidate, but after this inputs won't be able to display date, that was…
D.R.
  • 1,676
  • 2
  • 16
  • 37
3
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
  • 351
  • 2
  • 10
3
votes
2 answers

Kartik select2 widget not working in Ajax request in Yii2?

I am using kartik select2 widget in my yii2 basic app. now i have to display province names in select2 widget on ajax call. It is working fine if i put it directly in form. however not working with ajax call. Here are my form fields:
Vinit Singh
  • 1,113
  • 2
  • 21
  • 45
3
votes
2 answers

Error in accessing post json data in yii2

Am passing data to yii2 using ajax request but i keep on getting a 500 error This is the ajax request code:
Geoff
  • 4,505
  • 14
  • 65
  • 156
3
votes
2 answers

Filter result Pagination not working in yii2 gridview

im using Pjax gridview,After I search the results,when I click pagination ,the results changed to default results page not search result. and my search function is like public function search($params) { $query = UserLogs::find(); …
Jackhad
  • 331
  • 1
  • 6
  • 16
3
votes
4 answers

setting error action layout in yii2 not working

For setting error action I added this code in my controller public function beforeAction($action) { if ($action->id == 'error') $this->layout = 'iframe-main.php'; $this->enableCsrfValidation = false; return…
Jackhad
  • 331
  • 1
  • 6
  • 16
3
votes
1 answer

Two different layouts for Guest User & Logged in User- Yii2

Previously, I was having main.php where header & footer were declared. Which is Ok. Now, I am looking for 2 different layouts for Guest User & Registered User. In which Registered User and Admin will have different header & footer. I am using Yii2…
Nana Partykar
  • 10,175
  • 8
  • 43
  • 73
3
votes
1 answer

Yii2 grid view filter sql

Hi every one I have a grid view with SQLDataProvider and I'm doing the ModelSearch. Every tutorial on internet are with ActiveDataProvider and I don't want to use ActiveRecord because of the way I'm using my database. So my question is : how can I…
Samaël Villette
  • 198
  • 1
  • 22
1 2
3
51 52