Laravel Notfoundhttpexception

Asked

Viewed 1,474 times

2

I had a project in my machine where I created the Laravel via

$ New application Laravel

I copied this project to another machine with the perfect shampooing equal to the desiccation machine, but when I access the route

Route::get('/test/test', Function() { echo 'Ola Mundo'; });

He returns to 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 'Ola Mundo'; });

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

I tried everything to you

Composer update

php Artisan cache:clear

But nothing works, someone can help me ?

Hugs

  • Post all routes and there is not echo and Return.

1 answer

-1

Friend, I was with the same problem and I managed to solve, follow the following steps:

  1. Before creating the Controlle set the namespace of your project.

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

    $ php Artisan app:name your_name

    Ps.: Enter in "project name" the name you created with "new format ..."

    Ex.: php artisan app:name project

  2. Now we can create the controller, as an example I did 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 set a route to redirect and use the controller and 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
┗━━━━┳━━━━━┛ 
╭  ┃ 
┫╰╯┣╯  
╰┳┳╯ .

Browser other questions tagged

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