@forelse ($data['courses'] as $Course) @php $inWishlist = false; foreach ($data['wishlist'] as $wishlist) { if ($Course['id'] == $wishlist['course_id']) { $inWishlist = true; break; } } @endphp
{{$Course['course_id']}}
{{--
--}} {{-- @if($inWishlist)--}} {{-- --}} {{-- @else--}} {{-- --}} {{-- @endif--}} {{--
--}}
@if($Course['grade'] == -1)

PK

@elseif($Course['grade'] == 0)

K

@else

{{$Course['grade']}}

@endif
@foreach($data['teachers'] as $Teacher) @if($Course['teacher_id'] == $Teacher['id']) @endif @endforeach @php $ratings = DB::table('course_rating') ->where('course_id', $Course['id']) ->select(DB::raw('COUNT(*) as count, AVG(rating) as average')) ->first(); $count = $ratings->count; $average_rating = $ratings->average; $full_stars = floor($average_rating); $half_star = ceil($average_rating - $full_stars); $empty_stars = 5 - ($full_stars + $half_star); @endphp
Views (@if ($Course['views'] > 1000){{ number_format($Course['views'] / 1000, 1) }}K) @else{{ $Course['views'] }})@endif
@for($i = 1; $i <= $full_stars; $i++) @endfor @for($i = 1; $i <= $half_star; $i++) @endfor @for($i = 1; $i <= $empty_stars; $i++) @endfor {{ number_format($average_rating, 1) }}
{{--
--}} {{-- @foreach($data['subjects'] as $Subject)--}} {{-- @if($Course['c_id'] == $Subject['id'])--}} {{--
--}} {{--
--}} {{-- @foreach($data['subjects'] as $Subject)--}} {{-- @if($Course['c_id'] == $Subject['id'])--}} {{--

{{$Subject['c_name']}}

--}} {{-- @endif--}} {{-- @endforeach--}} {{--
--}} {{--
--}} {{-- @foreach($data['sub_subjects'] as $SubSubject)--}} {{-- @if($Course['sc_id'] == $SubSubject['id'])--}} {{--

{{$SubSubject['sc_name']}}

--}} {{-- @endif--}} {{-- @endforeach--}} {{--
--}} {{--
--}} {{-- @endif--}} {{-- @endforeach--}}
@if($inWishlist) @auth('student') @else @endauth @else @auth('student') @else @endauth @endif
@if($inWishlist) @auth('student') @else @endauth @else @auth('student') @else @endauth @endif
@foreach($data['subjects'] as $Subject) @if($Course['c_id'] == $Subject['id'])
@foreach($data['subjects'] as $Subject) @if($Course['c_id'] == $Subject['id'])

{{$Subject['c_name']}}

@endif @endforeach
@foreach($data['sub_subjects'] as $SubSubject) @if($Course['sc_id'] == $SubSubject['id'])

{{$SubSubject['sc_name']}}

@endif @endforeach
@endif @endforeach
@foreach($data['quizes'] as $Quiz) @if($Course['id'] == $Quiz['course_id']) @auth('student') @if(auth('student')->user()->valid_till >= \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', now())) @else @if(auth('student')->user()->quizes_attempt <= 10) @else @endif @endif @else @endauth @endif @endforeach
@empty

No Courses

@endforelse {{ $data['courses']->links() }}