app/Http/Controllers/PostController.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',
            'content' => 'required',
        ]);
        $post = Post::find($id);
        $post->users_id = auth()->user()->id;
        $post->title = $request->input('title');
        $post->content = $request->input('content');
        $post->updated_at = now();
        $post->save();
        return redirect('/dashboard')->with('status', 'Post Updated');
    }
public function update ( Request $ request , $ id ) { $ this -> validate ( $ request , [ 'title' => 'required' , 'content' => 'required' , ] ) ; $ post = Post :: find ( $ id ) ; $ post -> users_id = auth ( ) -> user ( ) -> id ; $ post -> title = $ request -> input ( 'title' ) ; $ post -> content = $ request -> input ( 'content' ) ; $ post -> updated_at = now ( ) ; $ post -> save ( ) ; return redirect ( '/dashboard' ) -> with ( 'status' , 'Post Updated' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .