I will put the image with tag in database. It can be svg also.
Like this:
Now I want to show the image with for loop.
#foreach($plan as $plan)
{ !! html_entity_decode($plan->plan_image) !! }
or
{!! $plan->plan_image !! }
#endforeach
Not working. How can I resolve this?
Thanks
I think this is not the way to go with images and the database. This way you will have a very little space to do any kind of customization.
If your code is not working, you can always do {{ dd($plan->plan_image) }} and see what happens.
Also, you should stop using Blade's or and start using ?? PHP's native null coalesce operator.
Related
I am new to Vue js, Inertia and Laravel.
But I have gotten stuck and cannot figure out what the problem is even though I try searching google and looking at videos.
I have this code
<div v-for="(seed, index) in seeds" :key="index">
Id {{ seed.id }}
<inertia-link :href="'/fert/' + '{{ seed.id }}'">
Go to seed
</inertia-link>
</div>
And The first {{ seed.id }} outside of the links looks great, it shows the actual id.
However then {{ seed.id }} within the link formats, so the link shows this:
Id 1Go to seed
Why is it formatting inside the link but not outside? and how to I fix it?
Thanks in advance, and yes I am very noob. sorry
You shouldn't use curly braces in attribute's value.
Using :[attribute-name] already tells Vue that you gonna use some JS expressions in value
:href="'/fert/' + seed.id"
You shouldn't use curly braces within the link. A nicer way to concatenate vars with text is to use template literal ES6 with backticks
<inertia-link :href="`/fert/${seed.id}`">Go to seed</inertia-link>
i hope you're having a good day.
i have some raw html that i want to render inside my blade file,
ive tried the {!!...!!} syntax but for some reason it is not working for me, when i use this
{ !! $jobs[0]->content !!}
i get this result
My laravel version is >8.
Thank you for your answer.
The syntax is without the space. Removing your leading space will solve your issue.
{!! $jobs[0]->content !!}
https://laravel.com/docs/8.x/blade#displaying-unescaped-data
Guys I need your help,
In summer note I add text like this:
summernote
But this is what I get as a result:
Result
What I do to desplay the text is like below:
{{ str_limit(strip_tags($place->description), 150) }}
Blade provides default protection against html/css/js code injection so you should try to use {!!instead of {{. Moreover, the strip_tags function will remove all html tags, but summernote will save what you wrote as html, so it needs it to be displayed as html. I would try something like that :
{!! str_limit($place->description, 150) !!}
Let me know if it helped you :)
I wanna put an image path in may laravel code like this
{!!Html::image({{$mdata->company_logo}},'logo',['width'=>60,'height'=>55])!!}
but {{$mdata->company_logo}} gives an error to html::image. I'm sure that image path from $mdata->company_logo has a valid data, namely the image path, because I can see it by using dd($data->company_logo).. But why html::image can't show the image...??
Thanks in advance.. :)
You shouldn't put the {{ }} around the $mdata->company_logo.
You are already inside a php block by using {!! !!} around Html::image().
Try {!!Html::image($mdata->company_logo,'logo',['width'=>60,'height'=>55])!!}.
I am going to use AngularJS along with Laravel, and I wanted to change Laravel tags to [[ ]] (which I think BTW is nicer since [ ] looks more like blade and is sharper :p )
Anyhow, I changed it with
Blade::setContentTags('[[', ']]'); // for variables and all things Blade
Blade::setEscapedContentTags('[[[', ']]]'); // for escaped data
How do I change the "Bracket Highlight" in Sublime now so that it still highlights my new tags??
Not directly answerting your question, but my solution to have Angular and Blade playing nice is very simple, I create a _partial every time I need some Angular and name this partial just '.php' and not '.blade.php', so if I have a form that uses Angular, I have:
{{ Form::open() }}
#include('_partials.posts.forms.create');
{{ Form::close() }}
In this case the included file would be views/_partials/posts/forms/create.php.
About Sublime, download Blade Syntax Highlighter, this file might give you a clue about how to change that for you:
https://github.com/Medalink/laravel-blade/blob/master/laravel-blade.tmLanguage