0

I am new to the Laravel while I reading the documentation I had a problem under routing.. it shows we can pass verifiable like this,

Route::get('user/{id}', function ($id) {
    return 'User '.$id;
});

here what is the user is it Controller or veritable name. I tried to pass the verbal like below but it is getting error

enter image description here

my route code is ,

Route::get('/{id}', function ($id) {
    echo 'ID: '.$id;
});
KBK
  • 375
  • 1
  • 4
  • 20
  • can you show complete route.php.because its working form me.and also make sure laravel project folder name spelled is correct or not. – Vision Coderz Oct 13 '16 at 09:27

2 Answers2

2

Your route is correct

Route::get('/{id}', function ($id) {
    echo 'ID: '.$id;
});

i have tested it and its working fine

Can you check .htaccess file under public folder.

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Also make sure about laravel project folder name is spelled correctly

Vision Coderz
  • 8,257
  • 5
  • 41
  • 57
1

As you can see in the url field you trying to get to public/32 and you should try to request such a url:

http://localhost/blog-laravel/public/user/32
Filip Koblański
  • 9,718
  • 4
  • 31
  • 36