// route
Route::get('myads/{id}/edit'`
<a href="/myads/{{$upload->id}}/editimage">Edit Image</a>|
change to
<a href="/myads/{{$upload->id}}/edit">Edit Image</a>|
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am working with Laravel 5.6 and MySQL DB. in my application I have some form data edit link from vehicles table, My edit link is this,
{{route('vehicles.edit',$vehicule->id.'/edit/')}}" >Edit</a>
and I have vehicle images show table as uploads and relationship between Vehicle model and Upload model is like this, vehicle model
public function uploads()
{
return $this->hasMany(Upload::class);
}
upload model
public function vehicle()
{
return $this->belongsTo(Vehicle::class);
}
and my vehicle edit route is like this,
Route::get('myads/{id}/edit', [
'uses' => '\App\Http\Controllers\VehicleController@edit',
'as'=> 'vehicles.edit'
]);
My edit blade file vehicle images showing as this,
@foreach( $vehicles-> uploads as $upload)
<img id="preview"
src="{{asset((isset($upload) && $upload->resized_name!='')?'images/'.$upload->resized_name:'images/noimage.png')}}"
height="200px" width="200px"/>
<input class="form-control" style="display:none" name="files[]" type="file" id="files" name="_token" value="{{ csrf_token() }}" enctype="multipart/form-data">
<br/>
<!-- <a href="javascript:changeProfile();">Add Image</a> | -->
<!-- <a style="color: red" href="javascript:removeImage()">Delete</a>
<input type="hidden" style="display: none" value="0" name="remove" id="remove"> -->
<a href="/myads/{{$upload->id}}/editimage">Edit Image</a>|
<a class="button is-outlined" href="/myads/{{$upload->id}}/delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>
<hr>
@endforeach
@endif
but when i click above edit link I got following error,
NotFoundHttpException
No query results for model [App\Upload] 8 //8 this is vehicle id
how can I fix this problem?
Please or to participate in this conversation.