4 months ago

Routing in Laravel?

Posted 4 months ago by piusbnsl

I am new to Laravel and I was watching laracasts' tutorial. I have a doubt in routing section. I also searched it google but I think I could not frame it properly. So I am trying here.

See, I am using Mac OS Mojave and have setup apache to serve files from Sites folder that I have created in my home directory. Now my laravel project has directory url - ~/Sites/Practice/myfirstsite. So I open Laravel project on chrome as - . As mentioned in tutorial I added another route for "/contact" in web.php and created a contact.blade.php page in views folder. But the problem is I am not able to access that contact page. I am putting this URL in chrome - .

in web.php -

Route::get('/contact', function(){
    return view('contact');

in contact.blade.php -


    <h1> Contact Us here </h1>
    <!-- <p> This section is under maintenance. </p> -->

Forgive me if I am asking very basic or stupid question. I tried searching on google and could not find it. If any other information is needed, tell me I will put it here.

Edit- I know that the way I am doing is not the right way to do things. Public folder should not be part of URL. I probably should change my document root directory to that of public folder. But my question is more of fundamental type. When I route to "/", works fine. But when I route to "/contact", does not work.

Also does not work.

Please sign in or create an account to participate in this conversation.