Skip to content
Advertisement

Tag: yii2

How can i add select tag to search model in yii2?

here i want to select Airline from a list this is the code: Answer <?= $form->field($model, ‘some_column’)->dropdownList([‘1’ => ‘aaa’, ‘2’ => ‘bbb’], [‘prompt’ => ‘—Select Data—‘]) ?> here is yii2 dropdown’s simplest view

Excel file cannot be read by arrays in php

Sorry for my english) I have a problem! I read file with extension .csv but each line returns string, like this I can’t convert these strings to array. This is my code. This is my file. Thank you for your help))) Answer You ask no question actually… But the CSV is quoted properly, at least if the double quotes ought

Validating data in a stored JSON file in the DB using YII framework

I am trying to write a rule in my Yii project to add an exempt rule when we have a data point collected on a stored JSON. The following is my sample Yii script for the validation rule In my database, I have a column where I store extra variables as a stored JSON as shown in the diagram below,

How make a many-to-many rest API in yii2

I’m trying to get a many-to-may relationship to work, but I can’t get it to work. I have a database with 3 tables: users, favorites & videos. The favorites table contains 2 foreign keys that point to the users table and the videos table. Currently I have the following: User Model: Video Model: VideoController: (ActiveController) Following what they did in:

How to handle error from controller using PJAX in YII2?

I am using Yii2 Pjax widget which is unable to throw error from controller due to which I am unable to log error for users when there is any error coming from the controller. PJAX code CONTROLLER code: I have tried below clientOptions but not working Also used javascript but no help :- Is there any way from which I

Yii2, how to add a LIMIT on a leftjoin to get only 1 result back

I am trying to get all records from the product table, these records are unique but i use a leftjoin to add a second table with images of these products but when I do it will return some products more than once as some products have 1 or more images. How can I use a limit on the product_images table

Advertisement