I have this bit of code in my form edit.blade.php
:
@php
$imagepath="images/Service/".$services->name."/";
$images=glob($imagepath.'*.*');
@endphp
<div class="row">
@foreach($images as $image)
@php
$count++;
@endphp
<div class="col-md-5">
<img src="" style="height: 150px;object-fit: contain;">
</div>
<div class="col-md-1"><input form="services" type="checkbox" name="deleteimagelink[]" value="" >
</div>
@endforeach
</div>
This is for passing the path of those images meant to be deleted. And I have this snippet in my controller:
print_r($request->input('deleteimagelink'));
$deletables=$request->input('deleteimagelink');
foreach ($deletables as $deletable)
{
print_r($deletable);
unlink($deletable);
}
I have this problem that nothing is being received in the $request->input('deleteimagelink')
parameter. Please guide me if I'm doing anything wrong. If nothing seems weird, can you please guide me how to deal with these checkbox situations in laravel. I consulted related answers from internet but nothing seems to work.
Aucun commentaire:
Enregistrer un commentaire