skip to Main Content

I am completely new to laravel, so I think my question is a bit ridiculous.
I tried to create a route in the routes/web.php

Route::get('/example', function () {
Return  ('hello');
)};

But when I try to see the example page, I receive 404.
I use php artisan serve to load the local host.
I couldn’t find a solution relatable to my situation. Still no luck.
Windows version 8.1
Laravel version 8
Also I can’t edit

Route::get('/', function () {
Return view  ('welcome');
});

The changes won’t apply
Thank you

3

Answers


  1. You can type php artisan route:list to see if the route saved or not, if not you can write :

    php artisan optimize:clear
    
    Login or Signup to reply.
  2. you must use:

    php artisan:serve
    

    then

    your_app_url/example
    

    and edit web.php — you have syntax error in web.php

    Route::get('/example', function () {
       return  'hello';
    });
    
    Login or Signup to reply.
  3. Your syntax is not correct.

    Route::get('/example', function () {
        Return  view('hello');
    });
    

    Make your hello.blade.php file add your html code that is your view file.run command php artisan route:clear.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search