app/Http/Controllers/ArticleController.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)
    {
        $request->validate([
            'title' => 'required|min:6',
            'content' => 'required|min:6'
        ]);
        $article = Article::find($id);
        $article->user_id = auth()->id();
        $article->title = $request->title;
        $article->content = $request->content;
        $article->save();
        return redirect()->route('article.index')->with('info', 'Data Update');
    }
public function update ( Request $ request , $ id ) { $ request -> validate ( [ 'title' => 'required|min:6' , 'content' => 'required|min:6' ] ) ; $ article = Article :: find ( $ id ) ; $ article -> user_id = auth ( ) -> id ( ) ; $ article -> title = $ request -> title ; $ article -> content = $ request -> content ; $ article -> save ( ) ; return redirect ( ) -> route ( 'article.index' ) -> with ( 'info' , 'Data Update' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .