update: literact material controller add function show_materials for teacher
This commit is contained in:
parent
c0c2f0552b
commit
13d3d1de40
|
|
@ -118,4 +118,17 @@ public function destroy($id)
|
||||||
$material->delete();
|
$material->delete();
|
||||||
return redirect()->route('literacy_teacher_materials');
|
return redirect()->route('literacy_teacher_materials');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show_materials($id)
|
||||||
|
{
|
||||||
|
$material = LiteracyMaterial::findOrFail($id);
|
||||||
|
|
||||||
|
// Pastikan file tersedia
|
||||||
|
if (!$material->file_path || !file_exists(public_path($material->file_path))) {
|
||||||
|
abort(404, 'File tidak ditemukan');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arahkan ke file langsung agar bisa ditampilkan di browser
|
||||||
|
return response()->file(public_path($material->file_path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user