0

I want to use a variable inside my progress bar, so it changes depending on the status of each $projek, but I couldn't get it to work by simply putting it in the style here is my code

@foreach($projek as $projek)
    <div style="padding-bottom: 16px;">
        <h6 style="font-weight: 600;">{{$projek->name}}</h6>
        <!-- <h7>{{$user->where('id',$projek->user_id)->pluck('name')}}</h7> -->
        <h6>{{$projek->status}}</h6>
        <div class="progress" style="height:8px">
            <div class="progress-bar" role="progressbar" style="width: '{{$projek->status}}' %"></div>
        </div>
    </div>
@endforeach

Here is the output Output

Hedayatullah Sarwary
  • 2,664
  • 3
  • 24
  • 38
  • It seems `$projek->status` already contains the `%` sign, so you don't need to write it in the CSS style. Just use an inspector to see what CSS property you are applying, learn how to debug easy code. – Vincent Decaux Jul 26 '21 at 07:18

1 Answers1

2

Check your code. Instead

<div class="progress-bar" role="progressbar" style="width: '{{$projek->status}}' %"></div> 

you should use

<div class="progress-bar" role="progressbar" style="width: {{$projek->status}}% "></div> 

While rendering, maybe your '%' was being ignored.

Kanaiya
  • 91
  • 3
  • Would u check this out please: https://stackoverflow.com/questions/68526658/session-still-submitted-after-redirecting-view –  Jul 26 '21 at 08:54
  • Done, I have posted answer for that question too :) – Kanaiya Jul 26 '21 at 10:16