1

I want show my total count as a progress bar with Laravel function. I wrote this function to get total count.

$countcomment = DB::table('comments')
                ->where('status', '=', 'Approved')
                ->count();

I want to show this count compare with 5000 as a percentage or value.my maximum count value is 5000.

3
  • What exactly do you want to count?? The total number of records in the database??? Commented Dec 20, 2018 at 6:09
  • please elaborate. do you want to compute for its percentage? Commented Dec 20, 2018 at 6:30
  • @Capt. Teemo yes compute it and show in a bootstrap progress bar Commented Dec 20, 2018 at 6:46

1 Answer 1

1

if you want to compute for the percentage of your $countcomment you can use this formula:

$percentage = ($countcomment/5000)*100;

Bootstrap 4

<div class="progress">
    <div class="progress-bar" role="progressbar" style="width: {{$percentage}}%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

it's ok. how can i show it in a bootstrap progress bar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.