@extends('staff.layouts.app') @section('content')

Edit Homework

@csrf @method('PUT')
@php $listSubjects = $subjects->where('class_id', $targetClassId); if ($listSubjects->count() === 0) $listSubjects = $subjects; // fallback: show all if none for class if ($homework->subject_id && !$listSubjects->firstWhere('id', $homework->subject_id)) { $current = $subjects->firstWhere('id', $homework->subject_id); if ($current) $listSubjects = collect([$current])->concat($listSubjects); } @endphp

Photos

{{-- Existing Photos --}} @php $existingPhotos = json_decode($homework->attachment ?? '[]', true) ?? []; @endphp @if(count($existingPhotos) > 0)
@foreach($existingPhotos as $photo)
@endforeach

Uploading new photos will replace these.

@endif
@endsection