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

noblemfd's avatar

How to resolve Page not found. No query results for model []

I have this controller:

public function goal_review()
{

    $userCompany = Auth::user()->company_id;
    $userEmployee = Auth::user()->employee_id;
    $identities = DB::table('appraisal_identity')->select('id')->where('company_id', $userCompany)->where('is_current', 1)->first();
    
    $goals = AppraisalGoal::where('employee_id', $userEmployee)->where('appraisal_identity_id', $identities->id)->get();

    return view('appraisal.appraisal_goals.goal_review')->with('goals', $goals);
}

route/web.php

Route::group(['prefix' => 'appraisal', 'as' => 'appraisal.', 'namespace' => 'Appraisal', 'middleware' => ['auth']], function () {
    Route::get('appraisal_goals/goal_review', 'AppraisalGoalsController@goal_review')->name('appraisal_goals.goal_review');
});

When I tried to render it with:

             <li class="nav-item">
               <a href="{{ route("appraisal.appraisal_goals.goal_review") }}" class="nav-link {{ request()->is('appraisal.appraisal_goals') || request()->is('appraisal.appraisal_goals/*') ? 'active' : '' }}">
                 <i class="nav-icon fas fa-balance-scale"></i>
                 <p>
                   <span>Goals Review</span>
                 </p>
               </a>
             </li>

I got this error:

Page not found. No query results for model [App\Models\Appraisal\AppraisalGoal] goal_review

How do I resolve this?

0 likes
3 replies
Snapey's avatar

Tell us more about the error message?

Also, have you checked that your query actually returns any data? Do you have the right combination of userEmployee and identities?

noblemfd's avatar

It's error 404. No code bug on the error page. Only states that:

Page not found. No query results for model [App\Models\Appraisal\AppraisalGoal] goal_review

Sinnbeck's avatar

Can you try this and check the output (if it is null that will cause issues). In any case you should make sure that you can find a valid id before moving on

$identities = DB::table('appraisal_identity')->select('id')->where('company_id', $userCompany)->where('is_current', 1)->first();
dd($identities->id);

Please or to participate in this conversation.