File::delete() will handle the array of files to be deleted for you,
At first, add it use Illuminate\Support\Facades\File;
public function destroy($id)
{
$infokeg = Infokeg::where('id', $id)->first();
$image[] = $infokeg->foto_kegiatan
// pass the array of files to deleted to it.
// if $image array is like this $image = ['file1.jpg', 'file2.png'];
File::delete($image);
return redirect('infokeg')->with('msg', 'Data Telah Terhapus');
}
Method 2
At first add use Illuminate\Support\Facades\Storage;
public function destroy($id)
{
$infokeg = Infokeg::where('id', $id)->first();
$image[] = $infokeg->foto_kegiatan
// pass the array of files to deleted to it.
// if $image array is like this $image = ['file.jpg', 'file2.jpg'];
Storage::delete($image);
return redirect('infokeg')->with('msg', 'Data Telah Terhapus');
}
For method 2 refer from docs
EDIT:
append public path to all,
foreach ($image as &$value) {
$value = public_path("data_file/".$value);
}
It will append the public path to all the values in the array, then use it in the delete() method as its argument.