Am using yii2 find() and would like to return only first five records
THIS IS what ive tried
$items= \frontend\models\TblResearch::find()->orderBy("id")->all();
That returs all the records what am looking for is
$items= \frontend\models\TblResearch::find()->orderBy("id")
->all(); //instead of all use like something to return five records
How do i go about this
I would like only to use the model approach not the sql
Use limit()
$items= \frontend\models\TblResearch::find()->orderBy("id")->limit(5)->all();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With