@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'));
}
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 :(
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.
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
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 didn't @vincej a while back have some similar problem with a route and have to update something. I can't find the post, but I think he updated laravel and it fixed the problem.
Found the post: https://laracasts.com/discuss/channels/laravel/route-list-not-the-same-as-webphp
@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)
@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.
Please or to participate in this conversation.