@php $review = App\Models\Review::where('course_id', $course->id) ->orderBy('id', 'DESC') ->get(); $total = $review->count(); $rating = array_sum(array_column($review->toArray(), 'rating')); $average_rating = 0; if ($total != 0) { $average_rating = $rating / $total; } $wishlist = App\Models\Wishlist::where('user_id', auth()->user()->id ?? '')->pluck('course_id')->toArray(); @endphp
course-thumbnail

@if ($course->is_paid == 0) {{ get_phrase('Free') }} @else @if ($course->discount_flag == 1) @php $discounted_price = number_format(($course->discounted_price), 2) @endphp {{ currency($discounted_price) }} {{ currency(number_format($course->price, 2)) }} @else {{ currency(number_format($course->price, 2)) }} @endif @endif

@auth @if (in_array($course->id, $wishlist)) @else @endif @endauth

{{ ucfirst($course->title) }}

  • {{ number_format($average_rating, 2) }}
  • {{ lesson_count($course->id) }} {{ get_phrase('lesson') }}
{{ get_phrase('Learn more') }}