@extends('layouts.admin') {{ config('app.name', 'Laravel') }} | Teacher | Student Activity Tracker @section('main-content')

Records / Activity Tracker

@foreach ($activityTrackers as $code => $activities) @php $firstActivity = $activities->first(); $imageArray = !empty($firstActivity->image) ? json_decode($firstActivity->image, true) : []; $linkType = $firstActivity->link_type; $link = $firstActivity->link; $cdnBaseUrl = config('services.aws.cdn'); $imageArray = array_map(fn($img) => $cdnBaseUrl . $img, $imageArray); @endphp @endforeach
S.no Description Student Name Images Links Activity Date
{{ $loop->iteration }} @php $desc = $firstActivity->description ?? 'N/A'; $shortDesc = strlen($desc) > 50 ? substr($desc, 0, 50) . '...' : $desc; @endphp
{{ $shortDesc }} @if (strlen($desc) > 50) @endif
@if (!empty($imageArray)) @else No Images @endif @php $linkLabel = match ($linkType) { 1 => 'YouTube Link', 2 => 'Video Link', 3 => 'Drive Link', 4 => 'PDF Link', default => 'View Link', }; $finalLink = in_array($linkType, [2, 4]) ? $cdnBaseUrl . ltrim($link, '/') : $link; @endphp {!! $link ? '' . $linkLabel . '' : 'No Link' !!} {{ \Carbon\Carbon::parse($firstActivity->created_at)->format('d M Y') }}
@endsection