Translate to Blade+Laravel a while loop

后端 未结 6 1533
無奈伤痛
無奈伤痛 2021-01-26 12:54

This code works, however in my learning of Laravel, I want to know if using Blade+Laravel syntax, can be better implemented



        
6条回答
  •  没有蜡笔的小新
    2021-01-26 13:29

    https://laravel.com/docs/5.5/blade#loops

    I would suggest using a for loop instead of a while loop in this case:

    @for ($i = 1; $i <= (5 - $post->images->count()); $i++)
        
    @endfor

提交回复
热议问题