php - Unable to print DB value from backend in Laravel Blade
I'm developing frontend for a songs website and I'm getting songs from backend like this;
{
"songs": {
"current_page": 1,
"data": [
{
"id": 3,
"title": "Song title",
"image": [
"image.jpeg"
],
"audio": [
"audio.mp3"
]
}
]
}
}
When I try to print {{ $song->title }}
it gets printed properly but the {{ asset("storage/images/$song->image" }}
get printed with ["image.jpeg"]
. Is there a way to strip them on frontend?
Answer
Solution:
The issue is solved as suggested by @kraph
{{ asset("storage/images/${song->image[0]}") }}
Thank you all.
Source