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($id)
    {
        $campos = request()->validate([
            "titulo" => "required",
            "categoria" => "required",
            "contenido" => "required",
            "fecha_de_creacion" => "required|date"
        ]);
        Post::where("id", $id)->update(array("titulo" => $campos["titulo"], "contenido" => $campos["contenido"]));
        return $this->show($id);
    }
public function update ( $ id ) { $ campos = request ( ) -> validate ( [ " titulo " => " required " , " categoria " => " required " , " contenido " => " required " , " fecha_de_creacion " => " required|date " ] ) ; Post :: where ( " id " , $ id ) -> update ( array ( " titulo " => $ campos [ " titulo " ] , " contenido " => $ campos [ " contenido " ] ) ) ; return $ this -> show ( $ id ) ; }
Update the specified resource in storage.
Update the specified resource in storage .