Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Laravel Controllers Controller Overview

Starting second laravel project - what do I need to do?

Hi there,

I have successfully progressed throughout much of Hampton's tutorial and successfully built a working application with Laravel. Yay! I am now trying to start a second project called 'bookings', but when I navigate to http://laravel.dev:8000/bookings/ in my URL, I get an error message:

Sorry, the page you are looking for could not be found. NotFoundHttpException in compiled.php line 7693

When I navigate to http://laravel.dev:8000/, I see the index to my former project, 'todo-lists'. How can I get both of these URLs to point to my new project?

My code for my 'bookings' project so far:

// routes.php

Route::get('/', function () {
    return view::make('bookings.index');
});

Route::get('/bookings', function()
{
    return View::make('bookings.index');
})

Route::get('/bookings/{id}', function()
{
    return View::make('bookings.show')->withId($id);
})


// index.blade.php

@extends('layouts.main')
@section('content')
    <h2>Show All Bookings</h2>

Any advice would be great! Thanks,

Robert Young London, UK

3 Answers

Sam Deacon
Sam Deacon
2,650 Points

I take it this is homestead? I've never developed laravel locally. So my only solution (not an answer to your question of course) is to try out the cloud IDE like cloud9 (Where each time you click new project you get a fresh docker / ubuntu disk image)

Yes - this is Homestead. Can I only have one local project on Homestead on any one time? Is there any way of setting up a second project without moving to Cloud Hosting?

Thanks!

Got some assistance with this from a colleague at work:

Homestead.yaml file:

folders: - map: ~/Code/laravel/ to: /home/vagrant/Code/laravel - map: ~/Code/booking/ to: /home/vagrant/Code/booking

sites: - map: laravel.dev to: /home/vagrant/Code/laravel/public - map: booking.dev to: /home/vagrant/Code/booking/public

Add booking.dev to your hosts file

Run Vagrant provision
Vagrant reload --provision