lundi 24 août 2015

laravel 5 NotFoundHttpException occurance

I have noticed that I get this error a lot. Say I start creating a CRUD for a projects table, but in the Controller I only do index, create and show. I get everything working with these functions as they should be.

At a later point, say I decide to add an edit function, something simple like

public function edit(Project $project)
{
    return view('projects.edit', compact('project'));
}

If I then try to edit the project, I get

NotFoundHttpException in RouteCollection.php line 143:

Even if I simply return a String I get the same Exception. From experience, if I restarted my entire project and added the edit function from the start, then it would work without problem.

I have tried clearing caches, deleting files in the storage folder, everything I can think off. Nothing seems to work however. This project is now quite large, and I really do not want to start it again.

I have checked route:list and the route is there and its all pointing to the correct locations. If I select edit, the page that shows the error has a url like

http://localhost:8000/projects//edit

So it is missing the id between projects/ and /edit. If I manually enter the id, then the page displays fine.

Is there anything I can do to get rid of this error without having to restart my project?

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NEUlsv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire