2
得到了与Laravel 4.一个小的n00b问题,我有以下途径:控制器路由与参数
Route::get('search', '[email protected]');
Route::get('edit/{$id}', '[email protected]');
Route::get('/', '[email protected]');
及以下控制器:
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);
}
}
现在这样的通话将无法工作:
<a href="edit/{{ $movie->movie_id }}">
我得到一个“NotFoundHttpException”。该URL看起来正确:laravel/public/edit/2例如
如果我从代码中删除所有$ id的东西,所以我只路由编辑,它的工作原理。
希望我能够表达自己,所以有人可以帮助我。这让我疯狂。
问候
感谢ü,告诉ü这是一个的n00b问题... – sjess
@AlexKevler不是的n00b,是啊! – EpokK