Support the ongoing development of Laravel.io →
Views Blade
Last updated 2 years ago.
0

hello, could you please post your routes?

all links created are absolute paths. so when you're working on localhost the url generated would be localhost/route, so when you transferred it to your live server and has a domain somesite.com, it would be the same thing. somesite.com/route

if the output is localhost:8000/www.somesite.com then you are doing something wrong.

Last updated 2 years ago.
0

My routes are as follows:

Route::get('{name}', function($name) {
	$site = Site::where('name', '=', $name)->with(array('scriptures', 'titles.listings'))->first();
	
	if ($site) {
		switch ($name) {
			case 'home':
			case 'mission':
			case 'history':	
			case 'thoughts':
						
				return View::make('home', array('scriptures'=>$site['scriptures'], 'titles'=>$site['titles'], 'site_id' => $site->id));
				
				break;
			case 'board':
			case 'donations':
			case 'nationally':
			case 'locally':
			case 'physical':
			case 'spiritual':
			case 'science':
			
				return View::make('ul', array('scriptures'=>$site['scriptures'], 'titles'=>$site['titles'], 'site_id' => $site->id));

				break;
			case 'sites':

				return View::make('sourcelist', array('scriptures'=>$site['scriptures'], 'titles'=>$site['titles'], 'site_id' => $site->id));
			
			default:
				return Event::first('404');
				break;
		}
		return 'Variable is empty';
	}
	
});
Route::controller('users', 'UsersController');

Route::group(array('before' => 'auth'), function() {

Route::resource('sites', 'SitesController');

Route::resource('sites.scriptures', 'ScripturesController');

Route::resource('sites.titles', 'TitlesController');

Route::resource('titles.listings', 'ListingsController');

});

I am trying to populate the links from MySQL, and they come up on my view as a link with the correct url, but when I click the link instead of going to the new site it adds localhost:8000/www.foo.com. That being said, all my routes work using localhost:8000/route

So upon further investigation it is because of my $name route slug that is picking up the link as a route and then throwing an error because it can't find that name in the DB. Is there any way around this, or a better way to have all my dynamic pages rather than making a route for each page individually.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.