Sorry sir im not clear
So im using this function to store the data image
public function insertproof(Request $request)
{
$id = $request['id'];
if ($request->hasFile('rent_proof')){
$filepath = $request->file('rent_proof')->store('public');
$result = rent::where('id',$id)->first();
$result->rent_proof=$filepath;
$result->save();
}
return redirect()->back()->with('status', 'proof updated');
}
this function gives me 'public/{filename}' on database
and it saved at
storage/app/public
with storage:link it also gives me
public/storage
according to documentation, i can use something like this
{{ 'storage/'.$rent->rent_proof }}
but i cant seems to load it through my view because i have id as the data
<button class="btn-success editrent"
data-id="{{ $rent->id }}"
data-proof="{{ $rent->rent_proof }}"//this one filepath
data-toggle="modal" data-target="#modal-insertproof">
<i class="fa fa-pencil" align="center">Input proof</i>
</button>
and this is my js
$(document).ready(function(){
$(document).on('click', '.editrent', function() {
$('#idrent').val($(this).data('id'));
$('#rentproof').val($(this).data('proof'));//filepath
});
my modal after i click
<form method="POST" action="{{route('visitor_rent.insertproof')}}" enctype="multipart/form-data">//use the insertproof controller
<div class="form-group">
<input type="file" class="form-control" name="rent_proof" id="rentproof" >
<img style="max-width: calc(100% - 20px)" src="**this is where im confused**">
</div>
</form
That is maybe the full question,but you were in right direction for guide me, even though im not giving spesific question.sorry for that sir. GBU and thanks sir.
So i got Solution now
$('#userphoto').attr("src"',"/storage/"+$(this).data('userphoto'));
Use this on modal trigger
and then we can pass id on the <img