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', 
                'description' => 'required',
                'colour' => 'required',
                'found_location' => 'required'
               ] );
            $post =  Post::find($id);
            $post->title = $request->input('title');
            $post->type = $request->input('type');
            $post->description = $request->input('description');
            $post->colour = $request->input('colour');
            $post->found_location = $request->input('found_location');
            $post->save();
            return redirect('/posts')->with('success', 'Post Updated');
         }
    }
public function update ( Request $ request , $ id ) { { $ this -> validate ( $ request , [ 'title' => 'required' , 'description' => 'required' , 'colour' => 'required' , 'found_location' => 'required' ] ) ; $ post = Post :: find ( $ id ) ; $ post -> title = $ request -> input ( 'title' ) ; $ post -> type = $ request -> input ( 'type' ) ; $ post -> description = $ request -> input ( 'description' ) ; $ post -> colour = $ request -> input ( 'colour' ) ; $ post -> found_location = $ request -> input ( 'found_location' ) ; $ post -> save ( ) ; return redirect ( '/posts' ) -> with ( 'success' , 'Post Updated' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .
//create post //$post->image = $request->input('image');