I have an array in my controller called days, which lists the days of the week and I pass it to my view.
I have columns in my DB table such as monday_start, tuesday_start, etc.
Within my view, I can access $product->monday_start
like a good boy.
I want to check to see if there's a value in product->XX_start
before I do something.
If I want to have a foreach loop for the days of the week and use $day to loop through my table columns, I can't figure out the syntax to append the $day variable onto my Eloquent accessor.
@foreach ($days as $day)
@if ($product->$day.'_start')
*do some stuff*
@endif
@endforeach
I can't figure out how to concatenate the $day
variable to '_start'
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2UAp3ds
via IFTTT
Aucun commentaire:
Enregistrer un commentaire