1
我通过从数据库获取数据创建了一个动态页面。从laravel的动态页面链接到另一个页面
实施例:example.com/post/SE12
是动态创建的这/SE12
。现在我在这个页面中有一个按钮,我想编辑帖子。
example.com/post/SE12/edit
。
如何使用laravel将按钮链接到此页面?以及如何路由此页面并在控制器中调用它?
在route.php
Route::resource('posts','PostsController');
Route::get('/posts/{code}', [ 'as'=>'post-show', 'uses'=>'[email protected]']);
谢谢!这工作。 – user1012181
另外,如果我想更新此页面,该怎么办? 我给了'{{Form :: open(['url'=>'posts /'.$ code。'/ update'])}}'在表单和路由中:'Route :: get('/ ('code'/ update',''as'=>'post-update','uses'=>'PostsController @ update']);' and in controller 'public function update($ code) {''''''返回'完成'; }' 但它不起作用 – user1012181
你得到了什么错误? – itachi