Route error when accessing the page in Laravel

Asked

Viewed 1,061 times

1

People after I executed this command in my Standard the situation in some pages got bad, are no longer working, the command is as follows:

Composer require mnabialek/Laravel-eloquent-filter

Error appears below, I have not made any changes other than executing this command. Reflectionexception in Route.php line 333: Method App Http Controllers Anunciocontroller::details() does not exist

After that I tried to install Composer and Composer update but nothing worked.

Below the code of my controller

<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use App\Http\Requests\AnunciosRequest;
use Illuminate\Http\Request;
use App\Anuncio;


class AnuncioController extends Controller {

    public function detalhes($id) {
        $animal = Anuncio::find($id);

        return view('anuncio.detalhes')->with('detalhe', $animal);
    }

My Routes.php file is correct, no changes, the first page works, but I don’t know what happened;

/* Rota para listar os produtos cadastrados */
Route::get("/", "HomeController@index");
Route::get("/anuncios/detalhes/{id}", "AnuncioController@detalhes");
  • Tried using: Route::get('anuncios/detalhes/{id}',['as'=>'anuncios.detalhes', 'uses'=>'AnuncioController@detalhes']); ?

  • I tried now, but without success, same error, maybe try to recreate all the whole controller again but I find it weird because the list page accesses the same controller and does not return any error.

  • This directly happens to me also kk in my case when I create route group or else do so works.

  • I just did a test here kkkk, tensed created from scratch and the same function called in this new controller and now it worked normal, weird more.

  • kkk Laravel has these same kk things so I don’t like using fullstacks frameworks, I always choose to use Silex or Troubadour (one I did rs.. put the answer there for your own question, just to record a solution)

1 answer

1

To solve this case it was necessary to create again the controller that was previously used.

executed the following command:

php artisan make:controller AnunciarController

After copying the function to this new controller and changing its name in the detail path, the error was no longer displayed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.