I have a Laravel model with many attributes. So, I need iterate over these attributes. How can I do this? Something like this:
@foreach($model->attributes as $attribute)
// use $attribute
@endforeach
is it possible?
I have a Laravel model with many attributes. So, I need iterate over these attributes. How can I do this? Something like this:
@foreach($model->attributes as $attribute)
// use $attribute
@endforeach
is it possible?
If you have an object, use getAttributes()
:
@foreach($model->getAttributes() as $key => $value)
// use $attribute
@endforeach