Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

Can you post your routes? Not sure you have things set up correctly.

Last updated 2 years ago.
0
<?php

Route::get('/', function()
{
	return View::make('hello');
});

Route::get('users', function()
{
    return 'Users!';
});

//Route::get('welcome', 'Home@showWelcome');
Route::get('welcome', 'HomeController@showWelcome');

controller code

public function showWelcome()
	{
		return View::make('emails/test');
                //return View::make('hello');
	}

view

<?php
echo "you are here";
?>
<a href="http://127.0.0.1/laravel/petdb/public/welcome">try</a>
<a href="http://127.0.0.1/laravel/petdb/public/users">try2</a>
<br>

Again though, it works first go. If I goto http://127.0.0.1/laravel/petdb/public/welcome it comes up. But if I click on the http://127.0.0.1/laravel/petdb/public/users link I get the Whoops, looks like something went wrong message. However if I clear history/cache/refresh, then http://127.0.0.1/laravel/petdb/public/users comes up correctly. Thanks, I hope you can figure this out. I am brand new to this framework. I have used eloquent orm outside of laravel. I just changed a controller/view to test whats going on. By the way I have tryed several things from stackoverflow, but none worked, plus played around with the htaccess file. But the routes work first go, so something is right, but something is also amiss.

Last updated 2 years ago.
0

Ok, so the public folder is technically what the browser would think is the route of the site. So your URL is a little of target.

Depending on your local server set up (mamp, wamp, vagrant etc), you need set it up so that /public is being served first. The index.php file in /public is actually the file that kicks everything off with Laravel. Everything else is technically above web root for security.

After that, all you'd need to do is visit http://127.0.0.1/users - that route would then return 'Users!' As you have specified.

It's the server set up at fault here really.

What set have you got? Mac or PC? If you are not familiar, then there is some software than can make it really easy to manage your local environment.

If you need any help with that side of things, give it a Google or shout on here.

Hopefully that will help a little.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jimgwhit jimgwhit Joined 13 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.