Answer the question
In order to leave comments, you need to log in
How to insert another one in the dataprovider request?
There is such a request for gridview
$query = self::find()->where('
user_id = :user_id AND sender_id != :user_id AND status != :status',
[
'user_id' => Yii::$app->user->id,
'status' => Pm::STATUS_DELETE,
])
->groupBy('sender_id')
->with(['profile']);
Answer the question
In order to leave comments, you need to log in
First get the number of records with status = 0, and then conditionally add a column.
$zeroStatusCount = self::find()->where('
user_id = :user_id AND sender_id != :user_id AND status = :status',
[
'user_id' => Yii::$app->user->id,
'status' => 0,
])
->groupBy('sender_id')
->count();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question