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