<img src="{{ asset('public/image/{{$blog->image}}') }}" alt="post image">
this gives a parse error PHP 8.1.2 9.3.1 Unclosed '(' does not match '}' please how can i nest that {{$blog->image}} inside the image src without getting an error, thanks
CodePudding user response:
You can concatenate strings with . just like in PHP.
When you use {{ inside blade template it is like using echo in php. Just concatenate them with a "." (dot)
<img src="{{ asset('public/image/' . $blog->image) }}" alt="post image">
CodePudding user response:
{{ }} behaves as an echo statement so you can't add echo in another echo. You just have to concatenate the string with variable like:
<img src="{{ asset('public/image/' . $blog->image) }}" alt="post image">