Reputation: 7138
I have stars
column in my testimonials
table where is gets numbers between 1
to 5
now i want to show stars depend on the number that saves in that column. For example if number is 2
show 2
stars and if is 5
show 5
stars like that.
I know it can be done trough my model but not sure how to do it.
PS: I want to use font-awesome
fa fa-star
to show stars in my blade.
any idea?
Maybe I need to explain little more, here is my table screenshot As you see there is only 1
column named stars
and it gets numbers between 1-5.
Upvotes: 1
Views: 293
Reputation: 11656
Try this in your view:
@for ($i = 0; $i < $star; $i++)
<i class="fa fa-star"></i>
@endfor
More on Laravel blade loops.
Upvotes: 1