how to print 1st reminder, 2nd reminder in gridview yii2 from model?

Multi tool use


how to print 1st reminder, 2nd reminder in gridview yii2 from model?
Here is my view page view.php
view.php
<div class="dataTables_wrapper form-inline dt-bootstrap">
<?= GridView::widget([
'dataProvider' => $dataProvider1,
'columns' => [
['class' => 'yiigridSerialColumn'],
[
'label' =>'Date',
'value' => 'date',
],
[
'label' =>'Reminder',
'value' => function($model){
return Yii::$app->session->get('').' '.$model['type'].' '.'reminder';
}
],
[
'label' =>'To',
'value' => 'recipients',
],
]
]); ?>
</div>
This is controller
$dataProvider1 = new ActiveDataProvider([
'query' => DomainReminders::find()
->where(['domain_id'=>$model['id']])
]);
$totalCount = $dataProvider1->getTotalCount();
return $this->renderAjax('view', [
'totalCount' => $totalCount,
'dataProvider' => $dataProvider,
'dataProvider1' => $dataProvider1,
true,
true
);
This is database with column name 'type' I want print like 1st reminder, 2nd reminder,3rd reminder in grid view
Now here is my output i want print like 1st, 2nd reminder
ORDER BY
no above table is view table.in databse have 'type' column i want to print like 1st reminder in REMINDER COLUMN TABLE
– Mangal
14 mins ago
1 Answer
1
You may use Inflector::ordinalize()
for this:
Inflector::ordinalize()
[
'label' => 'Reminder',
'value' => function ($model) {
return Inflector::ordinalize($model['type']) . ' reminder';
},
],
thanks a lot. it is working.
– Mangal
6 mins ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You mean
ORDER BY
the reminder column?– Mehdi
17 mins ago