This question already has an answer here:
I'm trying to display download links(pdf) on my page but I'm getting an index error
Undefined offset: 6 (View: C:\xampp\htdocs\bluepenlabs\fta\app\Modules\Fta\views\frontoffice\Fta\voir-docs.blade.php)
This is my controller :
public function docs(){
$docs = Document::all();
return view("Fta::frontoffice.Fta.voir-docs",compact('docs'));
}
this is the view
<?php
if(file_exists(public_path('frontoffice/fichiers/docs'))){
$files = File::allFiles(public_path('/frontoffice/fichiers/docs/'));
}
if(isset($docs)){
foreach ($docs as $doc){
//$fichier = explode("/", $file);
$fichier = explode("-", $doc['file']);
} $ext = explode(".", $fichier[6]);
}
?>
<span style="font-size: x-large;color: royalblue;"></span>
<br><br>
<p style="color: black">{!! $doc->description !!}</p>
<a href="/frontoffice/fichiers/docs//" download style="font-size: x-large"></a>
@if($ext[1]== "pdf")
<div class="box"><iframe src="/frontoffice/fichiers/docs//" width = "300px" height = "300px"></iframe></div>
@endif
<br>
<medium> Crée le : <br>Modifier le : </medium>
<hr>
<?php }
}
?>
I tried to dd($fichier) it gives me this :
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire