0
I was testing some features on the project site that I am doing in MVC, but it has a function that is not working anymore. When accessing the site it says:
"Method App Http Controllers updates::ret_user() does not exist"
Route:
Route::get("/update_user", "updates@retorna_usuario")->middleware('login');
But I do have this method in the controller:
class updates extends Controller
{
public function retorna_usuario()
{
$cargo = session('cargo');
$prontuario = session('prontuario');
$perfil = DB::table("users")->where('prontuario', '=', $prontuario)->OrderBy('nome')->first();
if($cargo == "A")
return view('editar.update_admin')->with('perfil', $perfil);
if($cargo == "P" || $cargo == "O")
return view("editar.update_user")->with('perfil', $perfil);
}}
What’s wrong with the code? I’ve used the composer update
in the prompt but it’s still making that mistake. What should I do?
Are you with Artisan to serve? Reset, log out and turn on Artisan
– Miguel
Yes! Already used the Artisan serves this running.
– WitnessTruth
Hang up and turn on, try again
– Miguel
What controller namespace? And what folder is it in?
– Miguel
I restarted the computer but it is still the same. The other controllers that are in the same folder are working. The namespace is namespace App Http Controllers; same as other controllers
– WitnessTruth
What is the controller file called? should be called updates.php
– Miguel
Yes, it is called updates.php
– WitnessTruth
Put Updatescontroller.php and the Updatescontroller class and also change the changes on the route... It has a pattern... It has a shape but there is something else
– novic
Boy, try writing your controller as follows: Route::get('/updates_user', array('as'=>'namenaota','uses'=>'updates@returns_user)); and see if it works. By the way, I would like you to run php Artisan Routes
– marksao
Guys, it was hopeless, I did what you suggested, but it didn’t work. I had a project backup prior to this problem and restored and the problem solved. The strange thing is that even deleting the controller still gave the same exception
– WitnessTruth
No way, I did what you suggested but it didn’t work. I had a backup of the project before this problem and I restored and the problem solved. The strange thing is that even deleting the controller it still gave the same exception. Thanks for all the help.
– WitnessTruth
One thing you can do is recompile
– Mauricio Wanderley Martins