@extends('layouts.app') @section('content')
@if(Auth::user()->role_id == 3)
← Back to Dashboard
@endif

Exercise Library

Please select a resource type to view exercises.

@if(request('resource'))
@php $sno = 1; @endphp
@forelse($exercises as $exercise) @if($exercise->ex_path && file_exists(public_path($exercise->ex_path))) @endif @empty @endforelse
S.No Thumbnail Exercise Name Action
{{ $sno++ }} @if(!empty($exercise->thumbnail_path)) Thumbnail @else N/A @endif {{ $exercise->ex_name }} @php $user = Auth::user(); @endphp {{-- Show Delete Button --}} @if($user->role_id == 2) {{-- Role 2 can delete any --}}
@csrf @method('DELETE')
@elseif($user->role_id == 1) {{-- Role 2 can delete any --}}
@csrf @method('DELETE')
@elseif($user->role_id == 3) {{-- Role 3: Only if they are the teacher of this exercise --}} @if($exercise->teacher_id == $user->id)
@csrf @method('DELETE')
@endif @endif
No exercises found for the selected resource.
@else @endif {{--

✨ This section can be used for summary, notes, or tips.

Upload New Exercise
--}} {{--
--}} @endsection @push('js') @endpush