Question

I am working with Laravel for a new project, and I am wanting to setup a new URL,

/project/create

I thought this would be as easy as doing the following,

<?php

class Project_Controller extends Base_Controller {

    public function action_create()
    {
        return "Step 1";
    }

}

However this returns a 404, can you not just setup an url base on /controller/action is this not the case, will I have to do this,

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

or similar for every URL/request the site needs?

Was it helpful?

Solution

You can do controller routing.

Option 1:

// Register a specific controller
Route::controller('project');

Option 2 (not recommended in Laravel 3 as known to be buggy sometimes):

 // Register all controllers and all routes
 Route::controller(Controller::detect());

You can see more options about routing and controller routing here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top