app/Http/Controllers/Admin/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(PostUpdateRequest $request, $id)
    {
        $post = Post::find($id);
        $this->authorize('pass', $post);         
        $post->fill($request->all())->save();
        if ($request->file('file')){
            $path = Storage::disk('public')->put('image', $request->file('file'));
            $post->fill(['file' => asset($path)])->save();
        }
        $post->tags()->sync($request->get('tags'));
        return redirect()-> route('posts.edit', $post->id)
            ->with('info', 'Entrada actualizada con éxito');
    }
public function update ( PostUpdateRequest $ request , $ id ) { $ post = Post :: find ( $ id ) ; $ this -> authorize ( 'pass' , $ post ) ; $ post -> fill ( $ request -> all ( ) ) -> save ( ) ; if ( $ request -> file ( 'file' ) ) { $ path = Storage :: disk ( 'public' ) -> put ( 'image' , $ request -> file ( 'file' ) ) ; $ post -> fill ( [ 'file' => asset ( $ path ) ] ) -> save ( ) ; } $ post -> tags ( ) -> sync ( $ request -> get ( 'tags' ) ) ; return redirect ( ) -> route ( 'posts.edit' , $ post -> id ) -> with ( 'info' , 'Entrada actualizada con éxito') ; }
Update the specified resource in storage.
Update the specified resource in storage .
//Validar //Image //relacion con el TAG