Laravel NotFoundHttpException

1

I had a project on my machine where I created the laravel via

  

$ laravel new application

I copied this project to another machine with the perfect xamp like the one of the tool of development, but when I go to the route

  

Route :: get ('/ test / test', function () {       echo 'Hello World';   });

It returns me

  

(1/1) NotFoundHttpException

     

in RouteCollection.php (line 179)   at RouteCollection-> match (object (Request)) in Router.php (line 548)

But if I access

  

Route :: get ('/', function () {echo 'Hello World';});

Without the parameters in the url it returns the Hello world.

I've tried everything

  

composer update

     

php artisan cache: clear

But nothing works, can anyone help me?

Hugs

    
asked by anonymous 28.06.2017 / 19:48

1 answer

0

Friend, I had the same problem and I managed to solve it, follow these steps:

  • Before creating the control, define the namespace of your project.

    → To change the default "namespace" of laravel we use the following command:

    $ php artisan app: name project_name

    Ps .: Enter "name of your_project" the name you created with "laravel new ..."

      Ex.:        php artisan app:name project

  • Now we can create the controller, as an example I did so in "\ app \ Http \ Controllers \ IndexController.php":
  • namespace project\Http\Controllers;
    
    class IndexController extends Controller {
      # Método para retornar a view principal
      public function index() {
    
        # Retornar a view principal:
        return view('index');
      }
    }
    


    3. Now we will define a route to redirect and use the controller and the method we created in "\ routes \ web.php": Route::get('/', 'IndexController@index');


    4. Finally, create the view to display the information in "\ resources \ views \ index.php".

    ┏━━━━━━━━━━┓ 
      Pronto!!!
      Fuiz...
      Rsrsrsr
    ┗━━━━┳━━━━━┛ 
    ╭                                    
    16.07.2017 / 20:21