Good day! Tell me, please, how to solve such a problem, I need to display entries in the ListView starting from the penultimate published one, not to display the last entry at all. Now I do like this

$story = Story::find()->orderBy(['publish_at' => SORT_DESC]); 

Those. I get all the entries sorted by publication date, along with the last one.

Thank you in advance!

  • unset($story[0]); - MasterAlex
  • LIMIT In general, this question arose due to a lack of fundamental knowledge and Yii2 has nothing to do with it. - Sergey

1 answer 1

 $story = Story::find()->orderBy(['publish_at' => SORT_DESC])->offset(1)->all(); 
  • one
    Thank you very much, you helped me a lot! - Rumato