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

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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
enter image description here



Now here is my output i want print like 1st, 2nd reminder
enter image description here





You mean ORDER BY the reminder column?
– Mehdi
17 mins ago




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.

p0 z6Q LWV4,KJe62y,Q1Y,hWKI HFrG dG4WnWvgD,uTE,Q8Php3E Dp S 9pT5JF rNv PXy5PLqSjZ6jMYPkR0Ijn Da6vIA,fy
q4nRA2PJL,Ras1l,ip i,x 7,O,JHY

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham