Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

moses's avatar
Level 2

How can I solve NotFoundHttpException No query results for model on laravel?

My code like this :

return redirect()->route('camp.don.summary', ['id'=>$dons->id]);

If the code executed, it will call route

The route like this :

Route::prefix('camp')->group(function(){
    ...
    Route::prefix('don')->group(function(){
        ...
        Route::get('summary/{id}', 'CampController@summary')->name('camp.don.summary');
    });
});

Then the route call controller

The controller like this :

public function summary($id)
{
    dd($id);
    return view('camp.don.summary.index');
}

On the browser, the url seems like this :

http://myapp.dev/camp/don/summary/31

And the content exist error like this :

(2/2) NotFoundHttpException No query results for model [App\Models\Camp] 31

How can I solve this error?

Seems my process is still wrong

0 likes
1 reply

Please or to participate in this conversation.