Home > database >  Laravel having space output issue in blade file
Laravel having space output issue in blade file

Time:04-04

I have Laravel code in Blade like this :

<span id="pk_dens" name="pk_dens" >
{{$productpages->pk_dens}}%
</span>

So in

it will add space in class like text- danger and text- success so class not apply

so how can I avoid that spce in if else condition ?

CodePudding user response:

Use ternary operator

<span id="pk_dens" name="pk_dens" >
    {{$productpages->pk_dens}}%
</span>

https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary

CodePudding user response:

I think you are missing here is ? in ternary syntax and to remove space just remove all white spaces from the span tag and make it in just one line.

<span id="pk_dens" name="pk_dens" >{{$productpages->pk_dens}}%</span>
  • Related