update: literact material controller add function show_materials for teacher
This commit is contained in:
parent
559fcaa946
commit
e96e342987
|
|
@ -118,4 +118,17 @@ public function destroy($id)
|
|||
$material->delete();
|
||||
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