2

got a little n00b problem with Laravel 4. I have following routes:

Route::get('search', 'MovieController@search');
Route::get('edit/{$id}', 'MovieController@edit');
Route::get('/', 'MovieController@index');

and the following controller:

class MovieController extends BaseController {

protected $layout = 'layouts.master';

public function index()
{
    $movies = Movie::paginate(30);
    return View::make('index')->with('movies', $movies);
}

public function search()
{
    if(isset($_REQUEST['sq'])) {
        Cache::forever('sq', $_REQUEST['sq']);
    }
    $movies = Movie::where('title', 'LIKE', '%'.Cache::get('sq').'%')->paginate(30);

    return View::make('index')->with('movies', $movies);
}

public function edit($id) {
    return View::make('edit')->with('id', $id);
    }

}

Now a call like this won't work:

<a href="edit/{{ $movie->movie_id }}">

I get a "NotFoundHttpException". The URL seems right: laravel/public/edit/2 e.g.

If i remove all the $id stuff from the code, so I route only to edit, it works.

Hopefully I could express myself enough, so somebody can help me. It's driving me nuts.

regards

1 Answer 1

4

In your routes.php, it's not Route::get('edit/{$id} ... but Route::get('edit/{id}

Sign up to request clarification or add additional context in comments.

1 Comment

@AlexKevler is not a n00b, yeah !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.