Ediashta Revin
Ediashta Revin

Reputation: 15

PHP inside inline style

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

Upvotes: 0

Views: 214

Answers (1)

Kanaiya
Kanaiya

Reputation: 91

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.

Upvotes: 2

Related Questions