Laravel使用用户权限进行路由错误

New to Laravel and im following along with a book called "Getting Started with Laravel 4" and i ran into a problem with routing.

My Routing file.

Route::model('cat', 'Cat');

/**
 * Route: Directs all index.php requests to cats index page
 *
 * @Template index.blade.php
 */
Route::get('/', function()
{
    return Redirect::to('cats');
});

/**
 * Route:
 */
Route::get('cats', function()
{
    $cats = Cat::all();
    return View::make('cats.index')
        ->with('cats', $cats);
});

/**
 * Route: Show cats by category.
 *
 * @Template index.php
 */
Route::get('cats/breeds/{name}', function($name)
{
    $breed = Breed::whereName($name)->with('cats')->first();
    return View::make('cats.index')
        ->with('breed', $breed)
        ->with('cats', $breed->cats);
});

/**
 * Route: Directs the user to the login page.
 *
 * @Template login.blade.php
 */
Route::get('login', function()
{
    return View::make('login');
});

/**
 * Route: Directs users to a single cat object page.
 *
 * @Template single.blade.php
 */
Route::get('cats/{cat}', function(Cat $cat)
{
    return View::make('cats.single')
        ->with('cat', $cat);
});

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

/**
 * Route: Authenticated route to create a cat in the database.
 *
 * @Template edit.blade.php.
 */
Route::get('cats/create', function()
{
    $cat = new Cat;
    return View::make('cats.edit')
        ->with('cat', $cat)
        ->with('method', 'post');
});

/**
 * Route: Edit cat by specific id.
 *
 * @Template edit.blade.php
 */
Route::get('cats/{cat}/edit', function(Cat $cat)
{
    return View::make('cats.edit')
        ->with('cat', $cat)
        ->with("method", 'put');
});

/**
 * Route: Delete a cat from the database
 *
 * @Template edit.blade.php
 */
Route::get('cats/{cat}/delete', function(Cat $cat)
{
    return View::make('cats.edit')
        ->with('cat', $cat)
        ->with('method', 'delete');
});

/**
 * Route: Updates cat object in database then redirects to cat page.
 *
 * @Template None
 */
Route::put('cats/{cat}', function(Cat $cat)
{
    if(Auth::user()->canEdit($cat)) {
        $cat->update(Input::all());
        return Redirect::to('cats/' . $cat->id)
            ->with('message', 'Successfully updated page!');
    }
    else {
        return Redirect::to('cats/' . $cat->id)
            ->with('error', "Unauthorized operation");
    }
});

/**
 *
 */
Route::post('cats', function()
{
    $cat = Cat::create(Input::all());
    $cat->user_id = Auth::user()->id;
    if($cat->save()){
        return Redirect::to('cats/' . $cat->id)
            ->with('message', 'Successfully created profile!');
    }
    else{
        return Redirect::Back()
            ->with('message', 'Could not create profile');
    }
});

/**
 * Route: Deletes cats from database and redirects to cats page
 *
 * @Template: edit.blade.php.
 */
Route::delete('cats/{cat}', function(Cat $cat){
    $cat->delete();
    return Redirect::to('cats')
        ->with('message', 'Successfully deleted page!');
});
});

/**
 * Route: Logs user in or redirects back to previous page.
 *
 * @Template: index.php
 */
Route::post('login', function()
{
    if(Auth::attempt(Input::only('username', 'password'))) {
        return Redirect::intended('/');
    } else {
        return Redirect::back()
            ->withInput()
            ->with('error', "Invalid credentials");
    }
});

/**
 * Route that logs the user out and redirects to index.php.
 */
Route::get('logout', function()
{
    Auth::logout();
    return Redirect::to('/')
        ->with('message', 'You are now logged out');
});

/**
 * Not that sure what this does, Binds cat to a view or something
 */
View::composer('cats.edit', function($view)
{
    $breeds = Breed::all();
    if(count($breeds) > 0){
        $breed_options = array_combine($breeds->lists('id'), $breeds->lists('name'));
    }
    else {
        $breed_options = array(null, 'Unspecified');
    }
    $view->with('breed_options', $breed_options);
});

I am trying to route to http://localhost/cats/public/index.php/cats/create an d i keep getting the NotFoundHttpException error. I not sure if its because of the order of my routs or what. Please help me.

You should rather test the following url:

http://localhost/cats/public/cats/create

and not:

http://localhost/cats/public/index.php/cats/create

I also think (I'm new to Laravel too) that you should move:

Route::get('cats/create', function()
{
    $cat = new Cat;
    return View::make('cats.edit')
        ->with('cat', $cat)
        ->with('method', 'post');
});

above

Route::get('cats/{cat}', function(Cat $cat)
{
    return View::make('cats.single')
        ->with('cat', $cat);
});

because the one with cats/{cat} and will be always true if url starts with cats/whatever