app/Http/Controllers/PostsController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        $this->validate($request,[
            'title' => 'required',
            'body' => 'required'
        ]);
        $post = Post::find($id);
        $post->title = $request->input('title');
        $post->body = $request->input('body');
        $post->save();
        return redirect('/post')->with('success', 'Post Updated');
    }
public function update ( Request $ request , $ id ) { $ this -> validate ( $ request , [ 'title' => 'required' , 'body' => 'required' ] ) ; $ post = Post :: find ( $ id ) ; $ post -> title = $ request -> input ( 'title' ) ; $ post -> body = $ request -> input ( 'body' ) ; $ post -> save ( ) ; return redirect ( '/post' ) -> with ( 'success' , 'Post Updated' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//CREATE POST