I'm building a blog with laravel and have edit functionality and resourceful controllers.
Here is the edit method from my controller :
public function edit($id)
{
$post = Post::find($id);
return View::make('posts.edit')->with('post',$post);
}
And my edit view :
<div class="containeredit">
{{Form::open(['action'=>'PostsController@update'])}}
{{Form::label('Title: ')}}
{{Form::text('title',$post['title'])}}
{{Form::label('Body: ')}}
{{Form::textarea('body',$post['body'])}}
<br>
{{Form::submit('Add Blog Post',['class'=>'btn btn-primary'])}}
{{Form::close()}}
and at last this is my update controller method
public function update($id)
{
$post = Post::find($id);
$input = Input::all();
$post->title = $input->title;
$post->body = $input->body;
$post->save();
return "hi";
}
But when I click on the edit button , I'm being routed to this url :
http://localhost:8000/posts/%7Bposts%7D
which leads to a not found error ,
How do I fix this?