My FAQ model has 4 attributes
* @property integer $id * @property string $chapter * @property string $question * @property string $answer
Now my actionIndex function looks like
public function actionIndex() { $faq = Faq::find()->all(); $dataProvider = new ActiveDataProvider([ 'query' => Faq::find(), ]); return $this->render('index', [ 'dataProvider' => $dataProvider, 'faq' => $faq ]); }
How can I get an array of unique $ chapter values โโusing Yii2 or PHP in the controller? Suppose in sql it looks like
SELECT DISTINCT chapter FROM ' faq_table'
arrays sql php activerecord yii2
st.limp
source share