app/Http/Controllers/NewsController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\News  $news
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, News $news)
    {
        $this->validate($request, [
            'title' => 'string|required|max:255',
            'body' => 'required|string|max:255',
            'main_photo' => 'image|mimes:jpg,jpeg,png|nullable|max:1000',
            'category' => 'required',
        ]);
        $news->update([
            'title' => $request->title,
            'content' => $request->body,
            'category_id' => $request->category
        ]);
        return redirect('admin/news')->with('success', 'News Edited Successfully');
    }
public function update ( Request $ request , News $ news ) { $ this -> validate ( $ request , [ 'title' => 'string|required|max:255' , 'body' => 'required|string|max:255' , 'main_photo' => 'image|mimes:jpg,jpeg,png|nullable|max:1000' , 'category' => 'required' , ] ) ; $ news -> update ( [ 'title' => $ request -> title , 'content' => $ request -> body , 'category_id' => $ request -> category ] ) ; return redirect ( 'admin/news' ) -> with ( 'success' , 'News Edited Successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .