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

Joeseph Chen's avatar

@sinnbeck sorry, typo on my part... yeah it is financial without s "(just had to pass the user as well in compact(). I expect that you are doing so using a view composer)" I'm not quite understand this part, can you please explain?

@snapey yes, it is a laravel 404 page

Sinnbeck's avatar

@dycoda You have this code refering $user but you only ever pass in $financial

@extends('layouts.app', ['title' => "Add {$user->name} Journal", 'activePage' => 'users'])
<a href="{{ route('profile', $user->id) }}" class="btn btn-danger">{{ __('Back') }}</a>

Did this to have access to $user

    public function edit(UserFinance $finance)
    {
        $user = User::find(1);
        return view('users.financial.edit', compact('finance', 'user'));
    }
Joeseph Chen's avatar

I forget to remove that because I didn't pass any user object to the view anymore, but even removing that part still returns me 404..

I think I need to rewrite all from scratch :(

ismaile's avatar

So the route is not defined even when you declare it in the RouteServiceProvider whereas other routes are properly defined. Maybe, you might consider if there is any hidden character or encoding issue in your route definition. Just tossing an idea around.

Joeseph Chen's avatar

yeah I get the route not defined if i change the edit button on the profile view to using a route(), and I tried it again before changing the button back to using a route and add my route Route::get('users/finances/{finance}/edit', 'UserFinancialController@edit')->name('userfinancial.edit'); to RouteServiceProvider.php file but still get the same error route not defined

Joeseph Chen's avatar

I think there is something wrong or something cached where I don't know..

I tried to delete all the route for finance


Route::get('users/finances/create', 'UserFinancialController@create')->name('userfinancial.create');
Route::get('users/finances/{finance}/edit', 'UserFinancialController@edit')->name('userfinancial.edit');

Route::post('users/finances', 'UserFinancialController@store')->name('userfinancial.store');
Route::put('users/finances/{finance}', 'UserFinancialController@update')->name('userfinancial.update');

but my app still can access the create and store route just fine even I already deleted the route above from my web.php file, weird..

EDIT: I have also checked php artisan route:list and the route for finance already removed from the list, but the create and store route still works just fine.. is there any ghost route in some file that I don't know?

Snapey's avatar

@jlrdw I remember that one now. Fixed by reinstalling Vendor files, which seemed excessive.

Reading @dycoda last post, it does point to the routes being cached. Well worth quickly checking if there is a file bootstrap/cache/routes.php and if so, delete it.

I'm wondering if there is condition where than can be non-writable by the current user (therefore cannot be flushed)

Joeseph Chen's avatar

@jlrdw @snapey I had read the post, the problem seems similar, like it keeps pointing to a cached route, but I have check my cache folder a few times but no cached route file. I even tried to restart the php, and then try to restart the valet, but strangely my problem solved itself when I restart my computer. But thank you so much for the solutions, at least I know what to do when this ghosting route appear again and also will help other people that having a same problem.

Previous

Please or to participate in this conversation.